package ventanasYDialogos;

import arti.tsb.LinkedList;
import entidades.Jugador;
import entidades.Mision;
import entidades.Pais;
import entidades.Tarjeta;
import entidades.Tropa;
import gestion.TiempoTurno;
import gestion.comunicacion.Cliente;
import herramientas.HashTable;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JToggleButton;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;

public class VPrincipal extends javax.swing.JFrame {

    private Cliente cli;
    private ArrayList<Jugador> jugadores;
    private HashTable paises = new HashTable(50);
    private JToggleButton jB_aux;
    private int cantidadTropasAgregar = 0;
    private int[] cantidadTropasAgregarPorContinentes = new int[6];
    private int ronda = 1;
    private int jugadorComienzaRonda;
    private int jugadorTurnoActual;
    private boolean esperandoSegundoPais = false;
    private JToggleButton jB_aux2;
    private String delimitador = "&-&-&";
    private boolean finPartida = false;
    private Mision[] misiones = {new Mision(0), new Mision(1), new Mision(2), new Mision(3), new Mision(4), new Mision(5), new Mision(6), new Mision(7), new Mision(8), new Mision(9), new Mision(10), new Mision(11), new Mision(12), new Mision(13)};
    private LinkedList tarjetas = new LinkedList();
    private ArrayList<Tarjeta> tarjetasFueraDelMazo = new ArrayList();
    private JCheckBox[] cb_tarjetas = new JCheckBox[5];
    private int nroCanje = 0;
    private int paisesConquistadosEnTurno = 0;
    private int cantidadPasar;
    private boolean cambioRonda = false;
    private TiempoTurno tt;
    private int tiempoTurno;
    private int tipoMision = 0;

    public VPrincipal(Cliente cli, ArrayList<Jugador> jugadores, int[] paises, int jugadorComienzaRonda, int misionPropia, int[] tarjetas, int tiempoTur, int tipoMis) {
        initComponents();
        this.tiempoTurno = tiempoTur;
        this.tipoMision = tipoMis;

        cb_tarjetas[0] = this.jCB_tarjeta0;
        cb_tarjetas[1] = this.jCB_tarjeta1;
        cb_tarjetas[2] = this.jCB_tarjeta2;
        cb_tarjetas[3] = this.jCB_tarjeta3;
        cb_tarjetas[4] = this.jCB_tarjeta4;

        for (int i = 0; i < 50; i++) {
            this.tarjetas.addFirst(new Tarjeta(tarjetas[i]));
        }
//Hilo Cliente
        this.cli = cli;
        this.cli.setVentanaPrincipal(this);

        configuracionInicialVentanas();



        this.jL_mapa.setIcon(new ImageIcon(getClass().getResource("/imagenes/mapa.png")));

        this.jugadores = jugadores;
        this.jugadorComienzaRonda = jugadorTurnoActual = jugadorComienzaRonda;



        for (int i = 0; i < jugadores.size(); i++) {
            if (jugadores.get(i).getId() == cli.getIdJugador()) {
                this.jTF_usuario.setText(jugadores.get(i).getNomUsuario());
                this.jTF_usuario.setForeground(new Color(jugadores.get(i).getCodigoDecimalColor()));

                Mision mision = misiones[misionPropia];
                jugadores.get(i).setMision(mision);
                mision.verficarExistenciaColor(jugadores, cli.getIdJugador());
                if (this.tipoMision == 0) {
                    this.jTA_mision.setText(mision.getDescripcion());
                    this.jIF_mision.toFront();
                }
                break;
            }
        }

        crearYAsignarPaises(paises);


        //Chatg
        this.jEP_comun.setContentType("text/html");
        this.jugadorComienzaRonda = jugadorComienzaRonda;
        //JFrame jugadores
        this.jP_jugadores.setLayout(null);
        int yJL = 0;
        for (int i = 0; i < jugadores.size(); i++) {
            //Label color
            JLabel jL_color = new JLabel();
            this.jP_jugadores.add(jL_color);
            jL_color.setBounds(5, yJL, 30, 30);
            String c = jugadores.get(i).getColor();
            jL_color.setIcon(new ImageIcon(getClass().getResource("/imagenes/" + c + ".png")));
            //Label jugadores
            JLabel jL = new JLabel(jugadores.get(i).getNomUsuario());
            jL.setName("" + i);
            this.jP_jugadores.add(jL);
            jL.setBounds(35, yJL, this.jP_jugadores.getWidth(), 30);
            jL.setFont(new Font("TimesRoman", Font.BOLD, 12));
            if (jugadorComienzaRonda == i) {
                jL.setForeground(Color.BLACK);
                jL.setText(jugadores.get(i).getNomUsuario() + " ←");
            } else {
                jL.setForeground(Color.GRAY);
                jL.setText(jugadores.get(i).getNomUsuario());
            }
            yJL += 25;
            jugadores.get(i).addJLabel(jL);
        }

        if (jugadorComienzaRonda == cli.getIdJugador()) {
            tt = new TiempoTurno(this.tiempoTurno, this);
            tt.start();
            habilitarAgregarTropas();
        }

    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jDesktopPane1 = new javax.swing.JDesktopPane();
        jIF_jugadores = new javax.swing.JInternalFrame();
        jP_jugadores = new javax.swing.JPanel();
        jIF_chat = new javax.swing.JInternalFrame();
        jSP_comun = new javax.swing.JScrollPane();
        jEP_comun = new javax.swing.JEditorPane();
        jTF_mandarMensaje = new javax.swing.JTextField();
        jIF_mapa = new javax.swing.JInternalFrame();
        jTB_0 = new javax.swing.JToggleButton();
        jTB_1 = new javax.swing.JToggleButton();
        jTB_2 = new javax.swing.JToggleButton();
        jTB_3 = new javax.swing.JToggleButton();
        jTB_4 = new javax.swing.JToggleButton();
        jTB_5 = new javax.swing.JToggleButton();
        jTB_6 = new javax.swing.JToggleButton();
        jTB_7 = new javax.swing.JToggleButton();
        jTB_8 = new javax.swing.JToggleButton();
        jTB_9 = new javax.swing.JToggleButton();
        jTB_10 = new javax.swing.JToggleButton();
        jTB_11 = new javax.swing.JToggleButton();
        jTB_12 = new javax.swing.JToggleButton();
        jTB_13 = new javax.swing.JToggleButton();
        jTB_14 = new javax.swing.JToggleButton();
        jTB_15 = new javax.swing.JToggleButton();
        jTB_16 = new javax.swing.JToggleButton();
        jTB_17 = new javax.swing.JToggleButton();
        jTB_18 = new javax.swing.JToggleButton();
        jTB_19 = new javax.swing.JToggleButton();
        jTB_20 = new javax.swing.JToggleButton();
        jTB_21 = new javax.swing.JToggleButton();
        jTB_22 = new javax.swing.JToggleButton();
        jTB_23 = new javax.swing.JToggleButton();
        jTB_24 = new javax.swing.JToggleButton();
        jTB_25 = new javax.swing.JToggleButton();
        jTB_26 = new javax.swing.JToggleButton();
        jTB_27 = new javax.swing.JToggleButton();
        jTB_28 = new javax.swing.JToggleButton();
        jTB_29 = new javax.swing.JToggleButton();
        jTB_30 = new javax.swing.JToggleButton();
        jTB_31 = new javax.swing.JToggleButton();
        jTB_32 = new javax.swing.JToggleButton();
        jTB_33 = new javax.swing.JToggleButton();
        jTB_34 = new javax.swing.JToggleButton();
        jTB_35 = new javax.swing.JToggleButton();
        jTB_36 = new javax.swing.JToggleButton();
        jTB_37 = new javax.swing.JToggleButton();
        jTB_38 = new javax.swing.JToggleButton();
        jTB_39 = new javax.swing.JToggleButton();
        jTB_40 = new javax.swing.JToggleButton();
        jTB_41 = new javax.swing.JToggleButton();
        jTB_42 = new javax.swing.JToggleButton();
        jTB_43 = new javax.swing.JToggleButton();
        jTB_44 = new javax.swing.JToggleButton();
        jTB_45 = new javax.swing.JToggleButton();
        jTB_46 = new javax.swing.JToggleButton();
        jTB_47 = new javax.swing.JToggleButton();
        jTB_48 = new javax.swing.JToggleButton();
        jTB_49 = new javax.swing.JToggleButton();
        jL_mapa = new javax.swing.JLabel();
        jIF_dados = new javax.swing.JInternalFrame();
        jP_dados = new javax.swing.JPanel();
        jL_d3 = new javax.swing.JLabel();
        jL_defensa = new javax.swing.JLabel();
        jL_ataque = new javax.swing.JLabel();
        jL_a1 = new javax.swing.JLabel();
        jL_d1 = new javax.swing.JLabel();
        jL_d2 = new javax.swing.JLabel();
        jL_a2 = new javax.swing.JLabel();
        jL_a3 = new javax.swing.JLabel();
        jIF_mision = new javax.swing.JInternalFrame();
        jSP_mision = new javax.swing.JScrollPane();
        jTA_mision = new javax.swing.JTextArea();
        jIF_tarjetas = new javax.swing.JInternalFrame();
        jL_tarjetaUs0 = new javax.swing.JLabel();
        jL_tarjetaUs1 = new javax.swing.JLabel();
        jL_tarjetaUs2 = new javax.swing.JLabel();
        jL_tarjetaUs3 = new javax.swing.JLabel();
        jL_tarjetaUs4 = new javax.swing.JLabel();
        jL_tarjeta0 = new javax.swing.JLabel();
        jL_tarjeta1 = new javax.swing.JLabel();
        jL_tarjeta2 = new javax.swing.JLabel();
        jL_tarjeta3 = new javax.swing.JLabel();
        jL_tarjeta4 = new javax.swing.JLabel();
        jL_tarjetaFondo0 = new javax.swing.JLabel();
        jL_tarjetaFondo1 = new javax.swing.JLabel();
        jL_tarjetaFondo2 = new javax.swing.JLabel();
        jL_tarjetaFondo3 = new javax.swing.JLabel();
        jL_tarjetaFondo4 = new javax.swing.JLabel();
        jCB_tarjeta1 = new javax.swing.JCheckBox();
        jCB_tarjeta2 = new javax.swing.JCheckBox();
        jCB_tarjeta3 = new javax.swing.JCheckBox();
        jCB_tarjeta4 = new javax.swing.JCheckBox();
        jCB_tarjeta0 = new javax.swing.JCheckBox();
        jB_usar = new javax.swing.JButton();
        jB_canjear = new javax.swing.JButton();
        jIF_tropas = new javax.swing.JInternalFrame();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jTF_cantTotales = new javax.swing.JTextField();
        jTF_cantAmSur = new javax.swing.JTextField();
        jTF_cantAmNorte = new javax.swing.JTextField();
        jTF_cantAfrica = new javax.swing.JTextField();
        jTF_cantEuropa = new javax.swing.JTextField();
        jTF_cantAsia = new javax.swing.JTextField();
        jTF_cantOceania = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jToolBar1 = new javax.swing.JToolBar();
        jB_agregar = new javax.swing.JButton();
        jSeparator4 = new javax.swing.JToolBar.Separator();
        jB_atacar = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        jB_reagrupar = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        jB_tarjeta = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        jB_terminarTurno = new javax.swing.JButton();
        jTF_tiempo = new javax.swing.JTextField();
        jTF_usuario = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jM_archivo = new javax.swing.JMenu();
        jMI_salir = new javax.swing.JMenuItem();
        jM_ventanas = new javax.swing.JMenu();
        jMI_ordenar = new javax.swing.JMenuItem();
        jM_traerAlFrente = new javax.swing.JMenu();
        jMI_chat = new javax.swing.JMenuItem();
        jMI_dados = new javax.swing.JMenuItem();
        jMI_jugadores = new javax.swing.JMenuItem();
        jMI_mapa = new javax.swing.JMenuItem();
        jMI_mision = new javax.swing.JMenuItem();
        jMI_tarjetas = new javax.swing.JMenuItem();
        jMI_tropas = new javax.swing.JMenuItem();
        jS_separador = new javax.swing.JPopupMenu.Separator();
        jCBMI_chat = new javax.swing.JCheckBoxMenuItem();
        jCBMI_dados = new javax.swing.JCheckBoxMenuItem();
        jCBMI_jugadores = new javax.swing.JCheckBoxMenuItem();
        jCBMI_mapa = new javax.swing.JCheckBoxMenuItem();
        jCBMI_mision = new javax.swing.JCheckBoxMenuItem();
        jCBMI_tarjetas = new javax.swing.JCheckBoxMenuItem();
        jCBMI_tropas = new javax.swing.JCheckBoxMenuItem();
        jM_ayuda = new javax.swing.JMenu();
        jMI_acercaDe = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("TEG CT - Partida");

        jDesktopPane1.setBackground(javax.swing.UIManager.getDefaults().getColor("Label.background"));
        jDesktopPane1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jDesktopPane1.setAutoscrolls(true);

        jIF_jugadores.setClosable(true);
        jIF_jugadores.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jIF_jugadores.setTitle("Jugadores");
        jIF_jugadores.setPreferredSize(new java.awt.Dimension(155, 64));
        jIF_jugadores.setVisible(true);
        jIF_jugadores.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentHidden(java.awt.event.ComponentEvent evt) {
                jIF_jugadoresComponentHidden(evt);
            }
            public void componentShown(java.awt.event.ComponentEvent evt) {
                jIF_jugadoresComponentShown(evt);
            }
        });

        jP_jugadores.setPreferredSize(new java.awt.Dimension(139, 371));
        jP_jugadores.setRequestFocusEnabled(false);

        javax.swing.GroupLayout jP_jugadoresLayout = new javax.swing.GroupLayout(jP_jugadores);
        jP_jugadores.setLayout(jP_jugadoresLayout);
        jP_jugadoresLayout.setHorizontalGroup(
            jP_jugadoresLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 139, Short.MAX_VALUE)
        );
        jP_jugadoresLayout.setVerticalGroup(
            jP_jugadoresLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 191, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jIF_jugadoresLayout = new javax.swing.GroupLayout(jIF_jugadores.getContentPane());
        jIF_jugadores.getContentPane().setLayout(jIF_jugadoresLayout);
        jIF_jugadoresLayout.setHorizontalGroup(
            jIF_jugadoresLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jP_jugadores, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jIF_jugadoresLayout.setVerticalGroup(
            jIF_jugadoresLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jP_jugadores, javax.swing.GroupLayout.DEFAULT_SIZE, 191, Short.MAX_VALUE)
        );

        jIF_jugadores.setBounds(650, 10, 155, 220);
        jDesktopPane1.add(jIF_jugadores, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jIF_chat.setClosable(true);
        jIF_chat.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jIF_chat.setResizable(true);
        jIF_chat.setTitle("Chat");
        jIF_chat.setVisible(true);
        jIF_chat.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentHidden(java.awt.event.ComponentEvent evt) {
                jIF_chatComponentHidden(evt);
            }
            public void componentShown(java.awt.event.ComponentEvent evt) {
                jIF_chatComponentShown(evt);
            }
        });

        jSP_comun.setAutoscrolls(true);
        jSP_comun.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jEP_comun.setEditable(false);
        jEP_comun.setAutoscrolls(false);
        jSP_comun.setViewportView(jEP_comun);

        jTF_mandarMensaje.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTF_mandarMensajeKeyPressed(evt);
            }
        });

        javax.swing.GroupLayout jIF_chatLayout = new javax.swing.GroupLayout(jIF_chat.getContentPane());
        jIF_chat.getContentPane().setLayout(jIF_chatLayout);
        jIF_chatLayout.setHorizontalGroup(
            jIF_chatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTF_mandarMensaje, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE)
            .addComponent(jSP_comun, javax.swing.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE)
        );
        jIF_chatLayout.setVerticalGroup(
            jIF_chatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jIF_chatLayout.createSequentialGroup()
                .addComponent(jTF_mandarMensaje, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSP_comun, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE))
        );

        jIF_chat.setBounds(0, 420, 468, 77);
        jDesktopPane1.add(jIF_chat, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jIF_mapa.setClosable(true);
        jIF_mapa.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jIF_mapa.setTitle("Mapa");
        jIF_mapa.setPreferredSize(new java.awt.Dimension(640, 400));
        jIF_mapa.setVisible(true);
        jIF_mapa.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentHidden(java.awt.event.ComponentEvent evt) {
                jIF_mapaComponentHidden(evt);
            }
            public void componentShown(java.awt.event.ComponentEvent evt) {
                jIF_mapaComponentShown(evt);
            }
        });
        jIF_mapa.getContentPane().setLayout(null);

        jTB_0.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_0.setText("0");
        jTB_0.setToolTipText("Chile");
        jTB_0.setBorderPainted(false);
        jTB_0.setContentAreaFilled(false);
        jTB_0.setEnabled(false);
        jTB_0.setFocusPainted(false);
        jTB_0.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_0.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_0.setName("0"); // NOI18N
        jTB_0.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_0.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_0);
        jTB_0.setBounds(110, 280, 30, 30);

        jTB_1.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_1.setText("0");
        jTB_1.setToolTipText("Argentina");
        jTB_1.setBorderPainted(false);
        jTB_1.setContentAreaFilled(false);
        jTB_1.setEnabled(false);
        jTB_1.setFocusPainted(false);
        jTB_1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_1.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_1.setName("1"); // NOI18N
        jTB_1.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_1);
        jTB_1.setBounds(140, 280, 30, 30);

        jTB_2.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_2.setText("0");
        jTB_2.setToolTipText("Uruguay");
        jTB_2.setBorderPainted(false);
        jTB_2.setContentAreaFilled(false);
        jTB_2.setEnabled(false);
        jTB_2.setFocusPainted(false);
        jTB_2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_2.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_2.setName("2"); // NOI18N
        jTB_2.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_2);
        jTB_2.setBounds(160, 250, 30, 30);

        jTB_3.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_3.setText("0");
        jTB_3.setToolTipText("Perú");
        jTB_3.setBorderPainted(false);
        jTB_3.setContentAreaFilled(false);
        jTB_3.setEnabled(false);
        jTB_3.setFocusPainted(false);
        jTB_3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_3.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_3.setName("3"); // NOI18N
        jTB_3.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_3);
        jTB_3.setBounds(110, 220, 30, 30);

        jTB_4.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_4.setText("0");
        jTB_4.setToolTipText("Brasil");
        jTB_4.setBorderPainted(false);
        jTB_4.setContentAreaFilled(false);
        jTB_4.setEnabled(false);
        jTB_4.setFocusPainted(false);
        jTB_4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_4.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_4.setName("4"); // NOI18N
        jTB_4.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_4);
        jTB_4.setBounds(150, 210, 30, 30);

        jTB_5.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_5.setText("0");
        jTB_5.setToolTipText("Colombia");
        jTB_5.setBorderPainted(false);
        jTB_5.setContentAreaFilled(false);
        jTB_5.setEnabled(false);
        jTB_5.setFocusPainted(false);
        jTB_5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_5.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_5.setName("5"); // NOI18N
        jTB_5.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_5);
        jTB_5.setBounds(100, 180, 30, 30);

        jTB_6.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_6.setText("0");
        jTB_6.setToolTipText("México");
        jTB_6.setBorderPainted(false);
        jTB_6.setContentAreaFilled(false);
        jTB_6.setEnabled(false);
        jTB_6.setFocusPainted(false);
        jTB_6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_6.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_6.setName("6"); // NOI18N
        jTB_6.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_6);
        jTB_6.setBounds(80, 140, 30, 30);

        jTB_7.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_7.setText("0");
        jTB_7.setToolTipText("California");
        jTB_7.setBorderPainted(false);
        jTB_7.setContentAreaFilled(false);
        jTB_7.setEnabled(false);
        jTB_7.setFocusPainted(false);
        jTB_7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_7.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_7.setName("7"); // NOI18N
        jTB_7.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_7);
        jTB_7.setBounds(70, 100, 30, 30);

        jTB_8.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_8.setText("0");
        jTB_8.setToolTipText("Oregon");
        jTB_8.setBorderPainted(false);
        jTB_8.setContentAreaFilled(false);
        jTB_8.setEnabled(false);
        jTB_8.setFocusPainted(false);
        jTB_8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_8.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_8.setName("8"); // NOI18N
        jTB_8.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_8);
        jTB_8.setBounds(50, 80, 30, 30);

        jTB_9.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_9.setText("0");
        jTB_9.setToolTipText("Nueva York");
        jTB_9.setBorderPainted(false);
        jTB_9.setContentAreaFilled(false);
        jTB_9.setEnabled(false);
        jTB_9.setFocusPainted(false);
        jTB_9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_9.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_9.setName("9"); // NOI18N
        jTB_9.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_9);
        jTB_9.setBounds(100, 80, 30, 30);

        jTB_10.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_10.setText("0");
        jTB_10.setToolTipText("Terranova");
        jTB_10.setBorderPainted(false);
        jTB_10.setContentAreaFilled(false);
        jTB_10.setEnabled(false);
        jTB_10.setFocusPainted(false);
        jTB_10.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_10.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_10.setName("10"); // NOI18N
        jTB_10.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_10);
        jTB_10.setBounds(130, 70, 30, 30);

        jTB_11.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_11.setText("0");
        jTB_11.setToolTipText("Labrador");
        jTB_11.setBorderPainted(false);
        jTB_11.setContentAreaFilled(false);
        jTB_11.setEnabled(false);
        jTB_11.setFocusPainted(false);
        jTB_11.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_11.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_11.setName("11"); // NOI18N
        jTB_11.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_11);
        jTB_11.setBounds(160, 50, 30, 30);

        jTB_12.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_12.setText("0");
        jTB_12.setToolTipText("Alaska");
        jTB_12.setBorderPainted(false);
        jTB_12.setContentAreaFilled(false);
        jTB_12.setEnabled(false);
        jTB_12.setFocusPainted(false);
        jTB_12.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_12.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_12.setName("12"); // NOI18N
        jTB_12.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_12);
        jTB_12.setBounds(30, 30, 30, 30);

        jTB_13.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_13.setText("0");
        jTB_13.setToolTipText("Yukón");
        jTB_13.setBorderPainted(false);
        jTB_13.setContentAreaFilled(false);
        jTB_13.setEnabled(false);
        jTB_13.setFocusPainted(false);
        jTB_13.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_13.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_13.setName("13"); // NOI18N
        jTB_13.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_13.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_13);
        jTB_13.setBounds(70, 40, 30, 30);

        jTB_14.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_14.setText("0");
        jTB_14.setToolTipText("Canadá");
        jTB_14.setBorderPainted(false);
        jTB_14.setContentAreaFilled(false);
        jTB_14.setEnabled(false);
        jTB_14.setFocusPainted(false);
        jTB_14.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_14.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_14.setName("14"); // NOI18N
        jTB_14.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_14.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_14);
        jTB_14.setBounds(100, 30, 30, 30);

        jTB_15.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_15.setText("0");
        jTB_15.setBorderPainted(false);
        jTB_15.setContentAreaFilled(false);
        jTB_15.setEnabled(false);
        jTB_15.setFocusPainted(false);
        jTB_15.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_15.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_15.setName("15"); // NOI18N
        jTB_15.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_15);
        jTB_15.setBounds(220, 10, 30, 30);

        jTB_16.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_16.setText("0");
        jTB_16.setBorderPainted(false);
        jTB_16.setContentAreaFilled(false);
        jTB_16.setEnabled(false);
        jTB_16.setFocusPainted(false);
        jTB_16.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_16.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_16.setName("16"); // NOI18N
        jTB_16.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_16);
        jTB_16.setBounds(300, 310, 30, 30);

        jTB_17.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_17.setText("0");
        jTB_17.setBorderPainted(false);
        jTB_17.setContentAreaFilled(false);
        jTB_17.setEnabled(false);
        jTB_17.setFocusPainted(false);
        jTB_17.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_17.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_17.setName("17"); // NOI18N
        jTB_17.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_17.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_17);
        jTB_17.setBounds(350, 300, 30, 30);

        jTB_18.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_18.setText("0");
        jTB_18.setBorderPainted(false);
        jTB_18.setContentAreaFilled(false);
        jTB_18.setEnabled(false);
        jTB_18.setFocusPainted(false);
        jTB_18.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_18.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_18.setName("18"); // NOI18N
        jTB_18.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_18);
        jTB_18.setBounds(290, 270, 30, 30);

        jTB_19.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_19.setText("0");
        jTB_19.setBorderPainted(false);
        jTB_19.setContentAreaFilled(false);
        jTB_19.setEnabled(false);
        jTB_19.setFocusPainted(false);
        jTB_19.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_19.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_19.setName("19"); // NOI18N
        jTB_19.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_19.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_19);
        jTB_19.setBounds(310, 240, 30, 30);

        jTB_20.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_20.setText("0");
        jTB_20.setBorderPainted(false);
        jTB_20.setContentAreaFilled(false);
        jTB_20.setEnabled(false);
        jTB_20.setFocusPainted(false);
        jTB_20.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_20.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_20.setName("20"); // NOI18N
        jTB_20.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_20.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_20);
        jTB_20.setBounds(250, 200, 30, 30);

        jTB_21.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_21.setText("0");
        jTB_21.setBorderPainted(false);
        jTB_21.setContentAreaFilled(false);
        jTB_21.setEnabled(false);
        jTB_21.setFocusPainted(false);
        jTB_21.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_21.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_21.setName("21"); // NOI18N
        jTB_21.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_21.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_21);
        jTB_21.setBounds(320, 200, 30, 30);

        jTB_22.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_22.setText("0");
        jTB_22.setBorderPainted(false);
        jTB_22.setContentAreaFilled(false);
        jTB_22.setEnabled(false);
        jTB_22.setFocusPainted(false);
        jTB_22.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_22.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_22.setName("22"); // NOI18N
        jTB_22.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_22.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_22);
        jTB_22.setBounds(250, 150, 30, 30);

        jTB_23.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_23.setText("0");
        jTB_23.setBorderPainted(false);
        jTB_23.setContentAreaFilled(false);
        jTB_23.setEnabled(false);
        jTB_23.setFocusPainted(false);
        jTB_23.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_23.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_23.setName("23"); // NOI18N
        jTB_23.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_23.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_23);
        jTB_23.setBounds(310, 150, 30, 30);

        jTB_24.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_24.setText("0");
        jTB_24.setBorderPainted(false);
        jTB_24.setContentAreaFilled(false);
        jTB_24.setEnabled(false);
        jTB_24.setFocusPainted(false);
        jTB_24.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_24.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_24.setName("24"); // NOI18N
        jTB_24.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_24.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_24);
        jTB_24.setBounds(270, 120, 30, 30);

        jTB_25.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_25.setText("0");
        jTB_25.setBorderPainted(false);
        jTB_25.setContentAreaFilled(false);
        jTB_25.setEnabled(false);
        jTB_25.setFocusPainted(false);
        jTB_25.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_25.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_25.setName("25"); // NOI18N
        jTB_25.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_25.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_25);
        jTB_25.setBounds(300, 100, 30, 30);

        jTB_26.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_26.setText("0");
        jTB_26.setBorderPainted(false);
        jTB_26.setContentAreaFilled(false);
        jTB_26.setEnabled(false);
        jTB_26.setFocusPainted(false);
        jTB_26.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_26.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_26.setName("26"); // NOI18N
        jTB_26.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_26.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_26);
        jTB_26.setBounds(340, 110, 30, 30);

        jTB_27.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_27.setText("0");
        jTB_27.setBorderPainted(false);
        jTB_27.setContentAreaFilled(false);
        jTB_27.setEnabled(false);
        jTB_27.setFocusPainted(false);
        jTB_27.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_27.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_27.setName("27"); // NOI18N
        jTB_27.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_27.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_27);
        jTB_27.setBounds(260, 80, 30, 30);

        jTB_28.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_28.setText("0");
        jTB_28.setBorderPainted(false);
        jTB_28.setContentAreaFilled(false);
        jTB_28.setEnabled(false);
        jTB_28.setFocusPainted(false);
        jTB_28.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_28.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_28.setName("28"); // NOI18N
        jTB_28.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_28.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_28);
        jTB_28.setBounds(370, 70, 30, 30);

        jTB_29.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_29.setText("0");
        jTB_29.setBorderPainted(false);
        jTB_29.setContentAreaFilled(false);
        jTB_29.setEnabled(false);
        jTB_29.setFocusPainted(false);
        jTB_29.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_29.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_29.setName("29"); // NOI18N
        jTB_29.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_29.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_29);
        jTB_29.setBounds(260, 40, 30, 30);

        jTB_30.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_30.setText("0");
        jTB_30.setBorderPainted(false);
        jTB_30.setContentAreaFilled(false);
        jTB_30.setEnabled(false);
        jTB_30.setFocusPainted(false);
        jTB_30.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_30.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_30.setName("30"); // NOI18N
        jTB_30.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_30.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_30);
        jTB_30.setBounds(310, 40, 30, 30);

        jTB_31.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_31.setText("0");
        jTB_31.setBorderPainted(false);
        jTB_31.setContentAreaFilled(false);
        jTB_31.setEnabled(false);
        jTB_31.setFocusPainted(false);
        jTB_31.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_31.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_31.setName("31"); // NOI18N
        jTB_31.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_31.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_31);
        jTB_31.setBounds(370, 200, 30, 30);

        jTB_32.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_32.setText("0");
        jTB_32.setBorderPainted(false);
        jTB_32.setContentAreaFilled(false);
        jTB_32.setEnabled(false);
        jTB_32.setFocusPainted(false);
        jTB_32.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_32.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_32.setName("32"); // NOI18N
        jTB_32.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_32.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_32);
        jTB_32.setBounds(460, 200, 30, 30);

        jTB_33.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_33.setText("0");
        jTB_33.setBorderPainted(false);
        jTB_33.setContentAreaFilled(false);
        jTB_33.setEnabled(false);
        jTB_33.setFocusPainted(false);
        jTB_33.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_33.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_33.setName("33"); // NOI18N
        jTB_33.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_33.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_33);
        jTB_33.setBounds(510, 190, 30, 30);

        jTB_34.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_34.setText("0");
        jTB_34.setBorderPainted(false);
        jTB_34.setContentAreaFilled(false);
        jTB_34.setEnabled(false);
        jTB_34.setFocusPainted(false);
        jTB_34.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_34.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_34.setName("34"); // NOI18N
        jTB_34.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_34.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_34);
        jTB_34.setBounds(370, 160, 30, 30);

        jTB_35.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_35.setText("0");
        jTB_35.setBorderPainted(false);
        jTB_35.setContentAreaFilled(false);
        jTB_35.setEnabled(false);
        jTB_35.setFocusPainted(false);
        jTB_35.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_35.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_35.setName("35"); // NOI18N
        jTB_35.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_35.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_35);
        jTB_35.setBounds(520, 140, 30, 30);

        jTB_36.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_36.setText("0");
        jTB_36.setBorderPainted(false);
        jTB_36.setContentAreaFilled(false);
        jTB_36.setEnabled(false);
        jTB_36.setFocusPainted(false);
        jTB_36.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_36.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_36.setName("36"); // NOI18N
        jTB_36.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_36.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_36);
        jTB_36.setBounds(480, 120, 30, 30);

        jTB_37.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_37.setText("0");
        jTB_37.setBorderPainted(false);
        jTB_37.setContentAreaFilled(false);
        jTB_37.setEnabled(false);
        jTB_37.setFocusPainted(false);
        jTB_37.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_37.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_37.setName("37"); // NOI18N
        jTB_37.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_37.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_37);
        jTB_37.setBounds(420, 110, 30, 30);

        jTB_38.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_38.setText("0");
        jTB_38.setBorderPainted(false);
        jTB_38.setContentAreaFilled(false);
        jTB_38.setEnabled(false);
        jTB_38.setFocusPainted(false);
        jTB_38.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_38.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_38.setName("38"); // NOI18N
        jTB_38.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_38.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_38);
        jTB_38.setBounds(590, 120, 30, 30);

        jTB_39.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_39.setText("0");
        jTB_39.setBorderPainted(false);
        jTB_39.setContentAreaFilled(false);
        jTB_39.setEnabled(false);
        jTB_39.setFocusPainted(false);
        jTB_39.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_39.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_39.setName("39"); // NOI18N
        jTB_39.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_39.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_39);
        jTB_39.setBounds(470, 90, 30, 30);

        jTB_40.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_40.setText("0");
        jTB_40.setBorderPainted(false);
        jTB_40.setContentAreaFilled(false);
        jTB_40.setEnabled(false);
        jTB_40.setFocusPainted(false);
        jTB_40.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_40.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_40.setName("40"); // NOI18N
        jTB_40.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_40.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_40);
        jTB_40.setBounds(410, 60, 30, 30);

        jTB_41.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_41.setText("0");
        jTB_41.setBorderPainted(false);
        jTB_41.setContentAreaFilled(false);
        jTB_41.setEnabled(false);
        jTB_41.setFocusPainted(false);
        jTB_41.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_41.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_41.setName("41"); // NOI18N
        jTB_41.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_41.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_41);
        jTB_41.setBounds(440, 40, 30, 30);

        jTB_42.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_42.setText("0");
        jTB_42.setBorderPainted(false);
        jTB_42.setContentAreaFilled(false);
        jTB_42.setEnabled(false);
        jTB_42.setFocusPainted(false);
        jTB_42.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_42.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_42.setName("42"); // NOI18N
        jTB_42.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_42.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_42);
        jTB_42.setBounds(500, 60, 30, 30);

        jTB_43.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_43.setText("0");
        jTB_43.setBorderPainted(false);
        jTB_43.setContentAreaFilled(false);
        jTB_43.setEnabled(false);
        jTB_43.setFocusPainted(false);
        jTB_43.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_43.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_43.setName("43"); // NOI18N
        jTB_43.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_43.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_43);
        jTB_43.setBounds(470, 40, 30, 30);

        jTB_44.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_44.setText("0");
        jTB_44.setBorderPainted(false);
        jTB_44.setContentAreaFilled(false);
        jTB_44.setEnabled(false);
        jTB_44.setFocusPainted(false);
        jTB_44.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_44.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_44.setName("44"); // NOI18N
        jTB_44.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_44.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_44);
        jTB_44.setBounds(560, 40, 30, 30);

        jTB_45.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_45.setText("0");
        jTB_45.setBorderPainted(false);
        jTB_45.setContentAreaFilled(false);
        jTB_45.setEnabled(false);
        jTB_45.setFocusPainted(false);
        jTB_45.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_45.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_45.setName("45"); // NOI18N
        jTB_45.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_45.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_45);
        jTB_45.setBounds(410, 170, 30, 30);

        jTB_46.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_46.setText("0");
        jTB_46.setBorderPainted(false);
        jTB_46.setContentAreaFilled(false);
        jTB_46.setEnabled(false);
        jTB_46.setFocusPainted(false);
        jTB_46.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_46.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_46.setName("46"); // NOI18N
        jTB_46.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_46.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_46);
        jTB_46.setBounds(540, 300, 30, 30);

        jTB_47.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_47.setText("0");
        jTB_47.setBorderPainted(false);
        jTB_47.setContentAreaFilled(false);
        jTB_47.setEnabled(false);
        jTB_47.setFocusPainted(false);
        jTB_47.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_47.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_47.setName("47"); // NOI18N
        jTB_47.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_47.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_47);
        jTB_47.setBounds(590, 300, 30, 30);

        jTB_48.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_48.setText("0");
        jTB_48.setBorderPainted(false);
        jTB_48.setContentAreaFilled(false);
        jTB_48.setEnabled(false);
        jTB_48.setFocusPainted(false);
        jTB_48.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_48.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_48.setName("48"); // NOI18N
        jTB_48.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_48.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_48);
        jTB_48.setBounds(520, 250, 30, 30);

        jTB_49.setFont(new java.awt.Font("Tahoma", 0, 8));
        jTB_49.setText("0");
        jTB_49.setBorderPainted(false);
        jTB_49.setContentAreaFilled(false);
        jTB_49.setEnabled(false);
        jTB_49.setFocusPainted(false);
        jTB_49.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jTB_49.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jTB_49.setName("49"); // NOI18N
        jTB_49.setPreferredSize(new java.awt.Dimension(30, 30));
        jTB_49.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                eventoBotonPais(evt);
            }
        });
        jIF_mapa.getContentPane().add(jTB_49);
        jTB_49.setBounds(580, 250, 30, 30);

        jL_mapa.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/mapa.png"))); // NOI18N
        jL_mapa.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jL_mapaMouseClicked(evt);
            }
        });
        jIF_mapa.getContentPane().add(jL_mapa);
        jL_mapa.setBounds(0, 0, 624, 371);

        jIF_mapa.setBounds(0, 10, 640, 400);
        jDesktopPane1.add(jIF_mapa, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jIF_dados.setClosable(true);
        jIF_dados.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jIF_dados.setTitle("Dados");
        jIF_dados.setPreferredSize(new java.awt.Dimension(126, 140));
        jIF_dados.setVisible(true);
        jIF_dados.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentHidden(java.awt.event.ComponentEvent evt) {
                jIF_dadosComponentHidden(evt);
            }
            public void componentShown(java.awt.event.ComponentEvent evt) {
                jIF_dadosComponentShown(evt);
            }
        });

        jP_dados.setLayout(null);

        jL_d3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_d3.setText(" ");
        jP_dados.add(jL_d3);
        jL_d3.setBounds(60, 70, 48, 14);

        jL_defensa.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_defensa.setText("Defensa");
        jP_dados.add(jL_defensa);
        jL_defensa.setBounds(60, 0, 48, 14);

        jL_ataque.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_ataque.setText("Ataque");
        jP_dados.add(jL_ataque);
        jL_ataque.setBounds(0, 0, 48, 14);

        jL_a1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_a1.setText(" ");
        jL_a1.setName(""); // NOI18N
        jP_dados.add(jL_a1);
        jL_a1.setBounds(0, 30, 48, 14);

        jL_d1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_d1.setText(" ");
        jP_dados.add(jL_d1);
        jL_d1.setBounds(60, 30, 48, 14);

        jL_d2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_d2.setText(" ");
        jP_dados.add(jL_d2);
        jL_d2.setBounds(60, 50, 48, 14);

        jL_a2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_a2.setText(" ");
        jP_dados.add(jL_a2);
        jL_a2.setBounds(0, 50, 48, 14);

        jL_a3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_a3.setText(" ");
        jP_dados.add(jL_a3);
        jL_a3.setBounds(0, 70, 48, 14);

        javax.swing.GroupLayout jIF_dadosLayout = new javax.swing.GroupLayout(jIF_dados.getContentPane());
        jIF_dados.getContentPane().setLayout(jIF_dadosLayout);
        jIF_dadosLayout.setHorizontalGroup(
            jIF_dadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jIF_dadosLayout.createSequentialGroup()
                .addComponent(jP_dados, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jIF_dadosLayout.setVerticalGroup(
            jIF_dadosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jP_dados, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE)
        );

        jIF_dados.setBounds(650, 250, 126, 130);
        jDesktopPane1.add(jIF_dados, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jIF_mision.setClosable(true);
        jIF_mision.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jIF_mision.setTitle("Misión secundaria");
        jIF_mision.setVisible(true);
        jIF_mision.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentHidden(java.awt.event.ComponentEvent evt) {
                jIF_misionComponentHidden(evt);
            }
            public void componentShown(java.awt.event.ComponentEvent evt) {
                jIF_misionComponentShown(evt);
            }
        });

        jSP_mision.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        jSP_mision.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);

        jTA_mision.setColumns(20);
        jTA_mision.setEditable(false);
        jTA_mision.setLineWrap(true);
        jTA_mision.setRows(5);
        jTA_mision.setWrapStyleWord(true);
        jTA_mision.setMargin(new java.awt.Insets(10, 10, 10, 10));
        jSP_mision.setViewportView(jTA_mision);

        javax.swing.GroupLayout jIF_misionLayout = new javax.swing.GroupLayout(jIF_mision.getContentPane());
        jIF_mision.getContentPane().setLayout(jIF_misionLayout);
        jIF_misionLayout.setHorizontalGroup(
            jIF_misionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSP_mision, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE)
        );
        jIF_misionLayout.setVerticalGroup(
            jIF_misionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSP_mision, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)
        );

        jIF_mision.setBounds(770, 350, 240, 70);
        jDesktopPane1.add(jIF_mision, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jIF_tarjetas.setClosable(true);
        jIF_tarjetas.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jIF_tarjetas.setTitle("Tarjetas");
        jIF_tarjetas.setVisible(true);
        jIF_tarjetas.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentHidden(java.awt.event.ComponentEvent evt) {
                jIF_tarjetasComponentHidden(evt);
            }
            public void componentShown(java.awt.event.ComponentEvent evt) {
                jIF_tarjetasComponentShown(evt);
            }
        });
        jIF_tarjetas.getContentPane().setLayout(null);

        jL_tarjetaUs0.setBackground(new java.awt.Color(204, 204, 204));
        jL_tarjetaUs0.setForeground(new java.awt.Color(255, 255, 255));
        jL_tarjetaUs0.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_tarjetaUs0.setPreferredSize(new java.awt.Dimension(80, 20));
        jIF_tarjetas.getContentPane().add(jL_tarjetaUs0);
        jL_tarjetaUs0.setBounds(20, 16, 80, 20);

        jL_tarjetaUs1.setBackground(new java.awt.Color(204, 204, 204));
        jL_tarjetaUs1.setForeground(new java.awt.Color(255, 255, 255));
        jL_tarjetaUs1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_tarjetaUs1.setPreferredSize(new java.awt.Dimension(80, 20));
        jIF_tarjetas.getContentPane().add(jL_tarjetaUs1);
        jL_tarjetaUs1.setBounds(124, 16, 80, 20);

        jL_tarjetaUs2.setBackground(new java.awt.Color(204, 204, 204));
        jL_tarjetaUs2.setForeground(new java.awt.Color(255, 255, 255));
        jL_tarjetaUs2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_tarjetaUs2.setPreferredSize(new java.awt.Dimension(80, 20));
        jIF_tarjetas.getContentPane().add(jL_tarjetaUs2);
        jL_tarjetaUs2.setBounds(227, 16, 80, 20);

        jL_tarjetaUs3.setBackground(new java.awt.Color(204, 204, 204));
        jL_tarjetaUs3.setForeground(new java.awt.Color(255, 255, 255));
        jL_tarjetaUs3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_tarjetaUs3.setPreferredSize(new java.awt.Dimension(80, 20));
        jIF_tarjetas.getContentPane().add(jL_tarjetaUs3);
        jL_tarjetaUs3.setBounds(332, 16, 80, 20);

        jL_tarjetaUs4.setBackground(new java.awt.Color(204, 204, 204));
        jL_tarjetaUs4.setForeground(new java.awt.Color(255, 255, 255));
        jL_tarjetaUs4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_tarjetaUs4.setPreferredSize(new java.awt.Dimension(80, 20));
        jIF_tarjetas.getContentPane().add(jL_tarjetaUs4);
        jL_tarjetaUs4.setBounds(435, 16, 80, 20);

        jL_tarjeta0.setBackground(new java.awt.Color(204, 204, 204));
        jL_tarjeta0.setForeground(new java.awt.Color(255, 255, 255));
        jL_tarjeta0.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_tarjeta0.setPreferredSize(new java.awt.Dimension(80, 20));
        jIF_tarjetas.getContentPane().add(jL_tarjeta0);
        jL_tarjeta0.setBounds(20, 120, 80, 20);

        jL_tarjeta1.setBackground(new java.awt.Color(204, 204, 204));
        jL_tarjeta1.setForeground(new java.awt.Color(255, 255, 255));
        jL_tarjeta1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_tarjeta1.setPreferredSize(new java.awt.Dimension(80, 20));
        jIF_tarjetas.getContentPane().add(jL_tarjeta1);
        jL_tarjeta1.setBounds(125, 120, 80, 20);

        jL_tarjeta2.setBackground(new java.awt.Color(204, 204, 204));
        jL_tarjeta2.setForeground(new java.awt.Color(255, 255, 255));
        jL_tarjeta2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_tarjeta2.setPreferredSize(new java.awt.Dimension(80, 20));
        jIF_tarjetas.getContentPane().add(jL_tarjeta2);
        jL_tarjeta2.setBounds(227, 120, 80, 20);

        jL_tarjeta3.setBackground(new java.awt.Color(204, 204, 204));
        jL_tarjeta3.setForeground(new java.awt.Color(255, 255, 255));
        jL_tarjeta3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_tarjeta3.setPreferredSize(new java.awt.Dimension(80, 20));
        jIF_tarjetas.getContentPane().add(jL_tarjeta3);
        jL_tarjeta3.setBounds(332, 120, 80, 20);

        jL_tarjeta4.setBackground(new java.awt.Color(204, 204, 204));
        jL_tarjeta4.setForeground(new java.awt.Color(255, 255, 255));
        jL_tarjeta4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jL_tarjeta4.setPreferredSize(new java.awt.Dimension(80, 20));
        jIF_tarjetas.getContentPane().add(jL_tarjeta4);
        jL_tarjeta4.setBounds(435, 120, 80, 20);

        jL_tarjetaFondo0.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        jIF_tarjetas.getContentPane().add(jL_tarjetaFondo0);
        jL_tarjetaFondo0.setBounds(10, 11, 98, 142);

        jL_tarjetaFondo1.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        jIF_tarjetas.getContentPane().add(jL_tarjetaFondo1);
        jL_tarjetaFondo1.setBounds(114, 11, 98, 142);

        jL_tarjetaFondo2.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        jIF_tarjetas.getContentPane().add(jL_tarjetaFondo2);
        jL_tarjetaFondo2.setBounds(218, 11, 98, 142);

        jL_tarjetaFondo3.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        jIF_tarjetas.getContentPane().add(jL_tarjetaFondo3);
        jL_tarjetaFondo3.setBounds(322, 11, 98, 142);

        jL_tarjetaFondo4.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));
        jIF_tarjetas.getContentPane().add(jL_tarjetaFondo4);
        jL_tarjetaFondo4.setBounds(426, 11, 98, 142);

        jCB_tarjeta1.setEnabled(false);
        jCB_tarjeta1.setName("1"); // NOI18N
        jCB_tarjeta1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCB_tarjetaActionPerfomed(evt);
            }
        });
        jIF_tarjetas.getContentPane().add(jCB_tarjeta1);
        jCB_tarjeta1.setBounds(150, 160, 20, 21);

        jCB_tarjeta2.setEnabled(false);
        jCB_tarjeta2.setName("2"); // NOI18N
        jCB_tarjeta2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCB_tarjetaActionPerfomed(evt);
            }
        });
        jIF_tarjetas.getContentPane().add(jCB_tarjeta2);
        jCB_tarjeta2.setBounds(260, 160, 20, 21);

        jCB_tarjeta3.setEnabled(false);
        jCB_tarjeta3.setName("3"); // NOI18N
        jCB_tarjeta3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCB_tarjetaActionPerfomed(evt);
            }
        });
        jIF_tarjetas.getContentPane().add(jCB_tarjeta3);
        jCB_tarjeta3.setBounds(360, 160, 20, 21);

        jCB_tarjeta4.setEnabled(false);
        jCB_tarjeta4.setName("4"); // NOI18N
        jCB_tarjeta4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCB_tarjetaActionPerfomed(evt);
            }
        });
        jIF_tarjetas.getContentPane().add(jCB_tarjeta4);
        jCB_tarjeta4.setBounds(465, 160, 20, 21);

        jCB_tarjeta0.setEnabled(false);
        jCB_tarjeta0.setName("0"); // NOI18N
        jCB_tarjeta0.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCB_tarjetaActionPerfomed(evt);
            }
        });
        jIF_tarjetas.getContentPane().add(jCB_tarjeta0);
        jCB_tarjeta0.setBounds(50, 160, 20, 21);

        jB_usar.setText("Usar");
        jB_usar.setEnabled(false);
        jB_usar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_usarActionPerformed(evt);
            }
        });
        jIF_tarjetas.getContentPane().add(jB_usar);
        jB_usar.setBounds(170, 190, 70, 23);

        jB_canjear.setText("Canjear");
        jB_canjear.setEnabled(false);
        jB_canjear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_canjearActionPerformed(evt);
            }
        });
        jIF_tarjetas.getContentPane().add(jB_canjear);
        jB_canjear.setBounds(280, 190, 90, 23);

        jIF_tarjetas.setBounds(400, 440, 550, 250);
        jDesktopPane1.add(jIF_tarjetas, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jIF_tropas.setClosable(true);
        jIF_tropas.setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
        jIF_tropas.setTitle("Agregar tropas");
        jIF_tropas.setVisible(true);
        jIF_tropas.addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentHidden(java.awt.event.ComponentEvent evt) {
                jIF_tropasComponentHidden(evt);
            }
            public void componentShown(java.awt.event.ComponentEvent evt) {
                jIF_tropasComponentShown(evt);
            }
        });

        jLabel1.setText("Globales: ");

        jLabel3.setText("América del Norte: ");

        jLabel4.setText("África: ");

        jLabel5.setText("Europa: ");

        jLabel6.setText("Asia: ");

        jLabel7.setText("Oceanía: ");

        jTF_cantTotales.setEditable(false);
        jTF_cantTotales.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jTF_cantTotales.setText("0");

        jTF_cantAmSur.setEditable(false);
        jTF_cantAmSur.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jTF_cantAmSur.setText("0");

        jTF_cantAmNorte.setEditable(false);
        jTF_cantAmNorte.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jTF_cantAmNorte.setText("0");

        jTF_cantAfrica.setEditable(false);
        jTF_cantAfrica.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jTF_cantAfrica.setText("0");

        jTF_cantEuropa.setEditable(false);
        jTF_cantEuropa.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jTF_cantEuropa.setText("0");

        jTF_cantAsia.setEditable(false);
        jTF_cantAsia.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jTF_cantAsia.setText("0");

        jTF_cantOceania.setEditable(false);
        jTF_cantOceania.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jTF_cantOceania.setText("0");

        jLabel8.setText("América del Sur: ");

        javax.swing.GroupLayout jIF_tropasLayout = new javax.swing.GroupLayout(jIF_tropas.getContentPane());
        jIF_tropas.getContentPane().setLayout(jIF_tropasLayout);
        jIF_tropasLayout.setHorizontalGroup(
            jIF_tropasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jIF_tropasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jIF_tropasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(jLabel7)
                    .addComponent(jLabel1)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jIF_tropasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jTF_cantTotales, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTF_cantAmSur, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTF_cantOceania, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTF_cantAsia, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTF_cantEuropa, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTF_cantAfrica, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTF_cantAmNorte, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(13, 13, 13))
        );
        jIF_tropasLayout.setVerticalGroup(
            jIF_tropasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jIF_tropasLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jIF_tropasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jTF_cantTotales, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jIF_tropasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTF_cantAmSur, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jIF_tropasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jTF_cantAmNorte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jIF_tropasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jTF_cantAfrica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jIF_tropasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jTF_cantEuropa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jIF_tropasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(jTF_cantAsia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jIF_tropasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(jTF_cantOceania, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(64, Short.MAX_VALUE))
        );

        jIF_tropas.setBounds(800, 70, 170, 280);
        jDesktopPane1.add(jIF_tropas, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jToolBar1.setFloatable(false);

        jB_agregar.setText("Agregar");
        jB_agregar.setEnabled(false);
        jB_agregar.setFocusable(false);
        jB_agregar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jB_agregar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jB_agregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_agregarActionPerformed(evt);
            }
        });
        jToolBar1.add(jB_agregar);
        jToolBar1.add(jSeparator4);

        jB_atacar.setText("Atacar");
        jB_atacar.setEnabled(false);
        jB_atacar.setFocusable(false);
        jB_atacar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jB_atacar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jB_atacar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_atacarActionPerformed(evt);
            }
        });
        jToolBar1.add(jB_atacar);
        jToolBar1.add(jSeparator3);

        jB_reagrupar.setText("Reagrupar");
        jB_reagrupar.setEnabled(false);
        jB_reagrupar.setFocusable(false);
        jB_reagrupar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jB_reagrupar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jB_reagrupar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_reagruparActionPerformed(evt);
            }
        });
        jToolBar1.add(jB_reagrupar);
        jToolBar1.add(jSeparator2);

        jB_tarjeta.setText("Tarjeta");
        jB_tarjeta.setEnabled(false);
        jB_tarjeta.setFocusable(false);
        jB_tarjeta.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jB_tarjeta.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jB_tarjeta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_tarjetaActionPerformed(evt);
            }
        });
        jToolBar1.add(jB_tarjeta);
        jToolBar1.add(jSeparator1);

        jB_terminarTurno.setText("TerminarTurno");
        jB_terminarTurno.setEnabled(false);
        jB_terminarTurno.setFocusable(false);
        jB_terminarTurno.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jB_terminarTurno.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jB_terminarTurno.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jB_terminarTurnoActionPerformed(evt);
            }
        });
        jToolBar1.add(jB_terminarTurno);

        jTF_tiempo.setEditable(false);
        jTF_tiempo.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jTF_usuario.setEditable(false);
        jTF_usuario.setHorizontalAlignment(javax.swing.JTextField.CENTER);

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel2.setText("Usuario:");

        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel9.setText("Tiempo de turno:");

        jM_archivo.setText("Archivo");

        jMI_salir.setText("Salir");
        jMI_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMI_salirActionPerformed(evt);
            }
        });
        jM_archivo.add(jMI_salir);

        jMenuBar1.add(jM_archivo);

        jM_ventanas.setText("Ventanas");

        jMI_ordenar.setText("Ordenar");
        jMI_ordenar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMI_ordenarActionPerformed(evt);
            }
        });
        jM_ventanas.add(jMI_ordenar);

        jM_traerAlFrente.setText("Traer al frente");

        jMI_chat.setText("Chat");
        jMI_chat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMI_chatActionPerformed(evt);
            }
        });
        jM_traerAlFrente.add(jMI_chat);

        jMI_dados.setText("Dados");
        jMI_dados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMI_dadosActionPerformed(evt);
            }
        });
        jM_traerAlFrente.add(jMI_dados);

        jMI_jugadores.setText("Jugadores");
        jMI_jugadores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMI_jugadoresActionPerformed(evt);
            }
        });
        jM_traerAlFrente.add(jMI_jugadores);

        jMI_mapa.setText("Mapa");
        jMI_mapa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMI_mapaActionPerformed(evt);
            }
        });
        jM_traerAlFrente.add(jMI_mapa);

        jMI_mision.setText("Misión secundaria");
        jMI_mision.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMI_misionActionPerformed(evt);
            }
        });
        jM_traerAlFrente.add(jMI_mision);

        jMI_tarjetas.setText("Tarjetas");
        jMI_tarjetas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMI_tarjetasActionPerformed(evt);
            }
        });
        jM_traerAlFrente.add(jMI_tarjetas);

        jMI_tropas.setText("Tropas para agregar");
        jMI_tropas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMI_tropasActionPerformed(evt);
            }
        });
        jM_traerAlFrente.add(jMI_tropas);

        jM_ventanas.add(jM_traerAlFrente);
        jM_ventanas.add(jS_separador);

        jCBMI_chat.setSelected(true);
        jCBMI_chat.setText("Chat");
        jCBMI_chat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCBMI_chatActionPerformed(evt);
            }
        });
        jM_ventanas.add(jCBMI_chat);

        jCBMI_dados.setSelected(true);
        jCBMI_dados.setText("Dados");
        jCBMI_dados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCBMI_dadosActionPerformed(evt);
            }
        });
        jM_ventanas.add(jCBMI_dados);

        jCBMI_jugadores.setSelected(true);
        jCBMI_jugadores.setText("Jugadores");
        jCBMI_jugadores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCBMI_jugadoresActionPerformed(evt);
            }
        });
        jM_ventanas.add(jCBMI_jugadores);

        jCBMI_mapa.setSelected(true);
        jCBMI_mapa.setText("Mapa");
        jCBMI_mapa.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCBMI_mapaActionPerformed(evt);
            }
        });
        jM_ventanas.add(jCBMI_mapa);

        jCBMI_mision.setSelected(true);
        jCBMI_mision.setText("Misión secundaria");
        jCBMI_mision.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCBMI_misionActionPerformed(evt);
            }
        });
        jM_ventanas.add(jCBMI_mision);

        jCBMI_tarjetas.setSelected(true);
        jCBMI_tarjetas.setText("Tarjetas");
        jCBMI_tarjetas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCBMI_tarjetasActionPerformed(evt);
            }
        });
        jM_ventanas.add(jCBMI_tarjetas);

        jCBMI_tropas.setSelected(true);
        jCBMI_tropas.setText("Tropas para agregar");
        jCBMI_tropas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCBMI_tropasActionPerformed(evt);
            }
        });
        jM_ventanas.add(jCBMI_tropas);

        jMenuBar1.add(jM_ventanas);

        jM_ayuda.setText("Ayuda");
        jM_ayuda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jM_ayudaActionPerformed(evt);
            }
        });

        jMI_acercaDe.setText("Acerca de");
        jMI_acercaDe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMI_acercaDeActionPerformed(evt);
            }
        });
        jM_ayuda.add(jMI_acercaDe);

        jMenuBar1.add(jM_ayuda);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 1020, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTF_usuario, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTF_tiempo, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(625, Short.MAX_VALUE))
            .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1030, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 523, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jTF_usuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTF_tiempo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jTF_mandarMensajeKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTF_mandarMensajeKeyPressed
    if (evt.getKeyCode() == 10) {
        String mensaje = this.jTF_mandarMensaje.getText();
        if (mensaje.compareTo("") != 0) {
            this.jTF_mandarMensaje.setText("");
            cli.mandarMensaje(mensaje);
        }
    }
}//GEN-LAST:event_jTF_mandarMensajeKeyPressed

private void jB_agregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_agregarActionPerformed
    if (this.jB_aux != null) {
        int idB = Integer.parseInt(this.jB_aux.getName());

        Pais p = (Pais) this.paises.getObject(Integer.parseInt(this.jB_aux.getName()));

        if (this.cantidadTropasAgregarPorContinentes[p.getIdContinente()] != 0) {
            this.cantidadTropasAgregarPorContinentes[p.getIdContinente()]--;
            switch (p.getIdContinente()) {
                case 0:
                    this.jTF_cantAmSur.setText("" + this.cantidadTropasAgregarPorContinentes[p.getIdContinente()]);
                    break;
                case 1:
                    this.jTF_cantAmNorte.setText("" + this.cantidadTropasAgregarPorContinentes[p.getIdContinente()]);
                    break;
                case 2:
                    this.jTF_cantAfrica.setText("" + this.cantidadTropasAgregarPorContinentes[p.getIdContinente()]);
                    break;
                case 3:
                    this.jTF_cantEuropa.setText("" + this.cantidadTropasAgregarPorContinentes[p.getIdContinente()]);
                    break;
                case 4:
                    this.jTF_cantAsia.setText("" + this.cantidadTropasAgregarPorContinentes[p.getIdContinente()]);
                    break;
                case 5:
                    this.jTF_cantOceania.setText("" + this.cantidadTropasAgregarPorContinentes[p.getIdContinente()]);
                    break;
            }
            agregarTropaPais(idB);
            this.cli.avisarAgregacionDeTropa(idB);
        } else {
            if (cantidadTropasAgregar != 0) {
                this.cantidadTropasAgregar--;
                this.jTF_cantTotales.setText("" + cantidadTropasAgregar);
                agregarTropaPais(idB);
                this.cli.avisarAgregacionDeTropa(idB);
            }
        }

        if (this.cantidadTropasAgregar == 0 && this.cantidadTropasAgregarPorContinentes[0] == 0 && this.cantidadTropasAgregarPorContinentes[1] == 0 && this.cantidadTropasAgregarPorContinentes[2] == 0 && this.cantidadTropasAgregarPorContinentes[3] == 0 && this.cantidadTropasAgregarPorContinentes[4] == 0 && this.cantidadTropasAgregarPorContinentes[5] == 0) {
            this.jB_agregar.setEnabled(false);
        }
    } else {
        JOptionPane.showOptionDialog(
                this,
                "Debes clickear un país para agregar tropas",
                "Atención",
                JOptionPane.DEFAULT_OPTION,
                JOptionPane.INFORMATION_MESSAGE,
                null,
                null,
                "aceptar");
    }
}//GEN-LAST:event_jB_agregarActionPerformed

private void jB_terminarTurnoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_terminarTurnoActionPerformed
    tt.parar();
    this.jB_agregar.setEnabled(false);
    this.jB_atacar.setEnabled(false);
    this.jB_reagrupar.setEnabled(false);
    this.jB_tarjeta.setEnabled(false);
    this.jB_terminarTurno.setEnabled(false);
    resetearCBTarjetas();
    this.jCB_tarjeta0.setEnabled(false);
    this.jCB_tarjeta1.setEnabled(false);
    this.jCB_tarjeta2.setEnabled(false);
    this.jCB_tarjeta3.setEnabled(false);
    this.jCB_tarjeta4.setEnabled(false);
    deshabilitarTodosPaises();
    cli.avisarFinTurno();
}//GEN-LAST:event_jB_terminarTurnoActionPerformed

private void jL_mapaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jL_mapaMouseClicked
    if (rondaAtaque() && cli.getIdJugador() == this.jugadorTurnoActual && !finPartida) {
        deshabilitarTodosPaises();
        habilitarPaises();
        resetearCBTarjetas();
        this.jB_usar.setEnabled(false);
        this.jB_canjear.setEnabled(false);
        this.esperandoSegundoPais = false;
        this.jB_aux = null;
        this.jB_aux2 = null;
        this.jIF_dados.toBack();
    } else if (cli.getIdJugador() == this.jugadorTurnoActual && !finPartida) {
        deshabilitarTodosPaises();
        habilitarPaises();
        resetearCBTarjetas();
    }
}//GEN-LAST:event_jL_mapaMouseClicked

private void jB_atacarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_atacarActionPerformed
    if (this.jB_aux != null && this.jB_aux2 != null) {

        if (!paisesMismoConquistador(this.jB_aux.getName(), this.jB_aux2.getName())) {
            atacar();
        } else {
            JOptionPane.showOptionDialog(
                    this,
                    "Los países seleccionados deben ser enemigos",
                    "Atención",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.INFORMATION_MESSAGE,
                    null,
                    null,
                    "aceptar");
        }
    } else {
        JOptionPane.showOptionDialog(
                this,
                "Debes clickear dos países para poder atacar",
                "Atención",
                JOptionPane.DEFAULT_OPTION,
                JOptionPane.INFORMATION_MESSAGE,
                null,
                null,
                "aceptar");
    }
}//GEN-LAST:event_jB_atacarActionPerformed

private void jB_reagruparActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_reagruparActionPerformed
    if (this.jB_aux != null && this.jB_aux2 != null) {
        if (paisesMismoConquistador(this.jB_aux.getName(), this.jB_aux2.getName())) {
            this.jB_atacar.setEnabled(false);
            reagrupar();
        } else {
            JOptionPane.showOptionDialog(
                    this,
                    "No se puede reagrupar entre países enemigos",
                    "Atención",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.INFORMATION_MESSAGE,
                    null,
                    null,
                    "aceptar");
        }
    } else {
        JOptionPane.showOptionDialog(
                this,
                "Debes clickear dos países para reagrupar tropas",
                "Atención",
                JOptionPane.DEFAULT_OPTION,
                JOptionPane.INFORMATION_MESSAGE,
                null,
                null,
                "aceptar");
    }

}//GEN-LAST:event_jB_reagruparActionPerformed

private void jB_tarjetaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_tarjetaActionPerformed
    this.jB_atacar.setEnabled(false);
    this.jB_reagrupar.setEnabled(false);
    tomarTarjeta();
    this.jB_tarjeta.setEnabled(false);
}//GEN-LAST:event_jB_tarjetaActionPerformed

private void eventoBotonPais(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eventoBotonPais
    apretarBotonPais(evt);
}//GEN-LAST:event_eventoBotonPais

private void jMI_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMI_salirActionPerformed
    this.dispose();
}//GEN-LAST:event_jMI_salirActionPerformed

private void jCBMI_mapaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBMI_mapaActionPerformed
    if (this.jCBMI_mapa.getState()) {
        this.jIF_mapa.show();
    } else {
        this.jIF_mapa.setVisible(false);
        this.jIF_mapa.hide();
    }
}//GEN-LAST:event_jCBMI_mapaActionPerformed

private void jIF_mapaComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_mapaComponentHidden
    this.jCBMI_mapa.setState(false);
}//GEN-LAST:event_jIF_mapaComponentHidden

private void jIF_mapaComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_mapaComponentShown
    this.jCBMI_mapa.setState(true);
}//GEN-LAST:event_jIF_mapaComponentShown

private void jIF_jugadoresComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_jugadoresComponentHidden
    this.jCBMI_jugadores.setState(false);
}//GEN-LAST:event_jIF_jugadoresComponentHidden

private void jIF_jugadoresComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_jugadoresComponentShown
    this.jCBMI_jugadores.setState(true);
}//GEN-LAST:event_jIF_jugadoresComponentShown

private void jCBMI_jugadoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBMI_jugadoresActionPerformed
    if (this.jCBMI_jugadores.getState()) {
        this.jIF_jugadores.show();
    } else {
        this.jIF_jugadores.setVisible(false);
        this.jIF_jugadores.hide();
    }
}//GEN-LAST:event_jCBMI_jugadoresActionPerformed

private void jCBMI_dadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBMI_dadosActionPerformed
    if (this.jCBMI_dados.getState()) {
        this.jIF_dados.show();
    } else {
        this.jIF_dados.setVisible(false);
        this.jIF_dados.hide();
    }
}//GEN-LAST:event_jCBMI_dadosActionPerformed

private void jCBMI_misionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBMI_misionActionPerformed
    if (this.jCBMI_mision.getState()) {
        this.jIF_mision.show();
    } else {
        this.jIF_mision.setVisible(false);
        this.jIF_mision.hide();
    }
}//GEN-LAST:event_jCBMI_misionActionPerformed

private void jCBMI_chatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBMI_chatActionPerformed
    if (this.jCBMI_chat.getState()) {
        this.jIF_chat.show();
    } else {
        this.jIF_chat.setVisible(false);
        this.jIF_chat.hide();
    }
}//GEN-LAST:event_jCBMI_chatActionPerformed

private void jIF_dadosComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_dadosComponentHidden
    this.jCBMI_dados.setState(false);
}//GEN-LAST:event_jIF_dadosComponentHidden

private void jIF_dadosComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_dadosComponentShown
    this.jCBMI_dados.setState(true);
}//GEN-LAST:event_jIF_dadosComponentShown

private void jIF_misionComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_misionComponentHidden
    this.jCBMI_mision.setState(false);
}//GEN-LAST:event_jIF_misionComponentHidden

private void jIF_misionComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_misionComponentShown
    this.jCBMI_mision.setState(true);
}//GEN-LAST:event_jIF_misionComponentShown

private void jIF_chatComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_chatComponentHidden
    this.jCBMI_chat.setState(false);
}//GEN-LAST:event_jIF_chatComponentHidden

private void jIF_chatComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_chatComponentShown
    this.jCBMI_chat.setState(true);
}//GEN-LAST:event_jIF_chatComponentShown

private void jCBMI_tropasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBMI_tropasActionPerformed
    if (this.jCBMI_tropas.getState()) {
        this.jIF_tropas.show();
    } else {
        this.jIF_tropas.setVisible(false);
        this.jIF_tropas.hide();
    }
}//GEN-LAST:event_jCBMI_tropasActionPerformed

private void jIF_tropasComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_tropasComponentHidden
    jCBMI_tropas.setState(false);
}//GEN-LAST:event_jIF_tropasComponentHidden

private void jIF_tropasComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_tropasComponentShown
    jCBMI_tropas.setState(true);
}//GEN-LAST:event_jIF_tropasComponentShown

private void jCB_tarjetaActionPerfomed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCB_tarjetaActionPerfomed
    this.jB_usar.setEnabled(false);
    this.jB_canjear.setEnabled(false);
    int cantidadSeleccionadas = 0;
    for (int i = 0; i < this.cb_tarjetas.length; i++) {
        if (this.cb_tarjetas[i].isSelected()) {
            cantidadSeleccionadas++;
        }
    }
    JCheckBox ch = (JCheckBox) evt.getSource();
    int idTar = Integer.parseInt(ch.getName());
    if (ch.isSelected()) {
        if (cantidadSeleccionadas == 1) {
            verificarTarjetaSeleccionada(idTar);
        } else if (cantidadSeleccionadas == 3) {
            verificarTarjetasSeleccionadasCanje();
        }
    } else {
        this.deshabilitarTodosPaises();
        this.habilitarPaises();
    }
    if (cantidadSeleccionadas == 1) {
        for (int i = 0; i < this.cb_tarjetas.length; i++) {
            if (this.cb_tarjetas[i].isSelected()) {
                verificarTarjetaSeleccionada(i);
            }
        }
    } else if (cantidadSeleccionadas == 3) {
        verificarTarjetasSeleccionadasCanje();
    }


}//GEN-LAST:event_jCB_tarjetaActionPerfomed

private void jIF_tarjetasComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_tarjetasComponentHidden
    jCBMI_tarjetas.setState(false);
}//GEN-LAST:event_jIF_tarjetasComponentHidden

private void jCBMI_tarjetasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCBMI_tarjetasActionPerformed
    if (this.jCBMI_tarjetas.getState()) {
        this.jIF_tarjetas.show();
    } else {
        this.jIF_tarjetas.setVisible(false);
        this.jIF_tarjetas.hide();
    }
}//GEN-LAST:event_jCBMI_tarjetasActionPerformed

private void jIF_tarjetasComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_jIF_tarjetasComponentShown
    jCBMI_tarjetas.setState(true);
}//GEN-LAST:event_jIF_tarjetasComponentShown

private void jMI_ordenarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMI_ordenarActionPerformed
    this.configuracionInicialVentanas();
}//GEN-LAST:event_jMI_ordenarActionPerformed

private void jB_usarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_usarActionPerformed
    for (int i = 0; i < this.cb_tarjetas.length; i++) {
        if (this.cb_tarjetas[i].isSelected()) {
            Jugador j = this.jugadores.get(this.jugadorTurnoActual);
            Tarjeta t = j.getTarjeta(i);
            if (!t.isUsada()) {
                switch (i) {
                    case 0:
                        this.jL_tarjetaUs0.setText("(usada)");
                        break;
                    case 1:
                        this.jL_tarjetaUs1.setText("(usada)");
                        break;
                    case 2:
                        this.jL_tarjetaUs2.setText("(usada)");
                        break;
                    case 3:
                        this.jL_tarjetaUs3.setText("(usada)");
                        break;
                    case 4:
                        this.jL_tarjetaUs4.setText("(usada)");
                        break;
                }
                t.setUsada(true);
                int idPais = t.getId();
                j.getPais(idPais).addTropa(new Tropa(true));
                j.getPais(idPais).addTropa(new Tropa(true));
                this.jB_usar.setEnabled(false);
                cli.avisarUsoTarjeta(idPais);
            }
            break;
        }
    }
}//GEN-LAST:event_jB_usarActionPerformed

private void jB_canjearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jB_canjearActionPerformed
    Jugador j = this.jugadores.get(this.jugadorTurnoActual);
    int[] nrosTarjs = new int[3];
    int cont = 0;
    for (int i = 0; i < this.cb_tarjetas.length; i++) {
        if (this.cb_tarjetas[i].isSelected()) {
            nrosTarjs[cont] = j.getTarjetas().get(i).getId();
            cont++;
        }
    }
    Tarjeta t1 = j.removeTarjeta(nrosTarjs[0]);
    this.tarjetasFueraDelMazo.add(t1);
    Tarjeta t2 = j.removeTarjeta(nrosTarjs[1]);
    this.tarjetasFueraDelMazo.add(t2);
    Tarjeta t3 = j.removeTarjeta(nrosTarjs[2]);
    this.tarjetasFueraDelMazo.add(t3);
    this.jB_canjear.setEnabled(false);

    switch (nroCanje) {
        case 0:
            this.cantidadTropasAgregar += 4;
            break;
        case 1:

            this.cantidadTropasAgregar += 7;
            break;
        case 2:
            this.cantidadTropasAgregar += 10;
            break;
        default:
            this.cantidadTropasAgregar += (nroCanje * 5);
            break;

    }
    this.jTF_cantTotales.setText("" + this.cantidadTropasAgregar);
    nroCanje++;

    actualizarVentanaTarjetas(j);

    cli.avisarCanjeTarjeta(nrosTarjs[0], nrosTarjs[1], nrosTarjs[2]);
}//GEN-LAST:event_jB_canjearActionPerformed

private void jMI_chatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMI_chatActionPerformed
    this.jIF_chat.toFront();
}//GEN-LAST:event_jMI_chatActionPerformed

private void jMI_dadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMI_dadosActionPerformed
    this.jIF_dados.toFront();
}//GEN-LAST:event_jMI_dadosActionPerformed

private void jMI_jugadoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMI_jugadoresActionPerformed
    this.jIF_jugadores.toFront();

}//GEN-LAST:event_jMI_jugadoresActionPerformed

private void jMI_mapaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMI_mapaActionPerformed
    this.jIF_mapa.toFront();

}//GEN-LAST:event_jMI_mapaActionPerformed

private void jMI_misionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMI_misionActionPerformed
    this.jIF_mision.toFront();

}//GEN-LAST:event_jMI_misionActionPerformed

private void jMI_tarjetasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMI_tarjetasActionPerformed
    this.jIF_tarjetas.toFront();

}//GEN-LAST:event_jMI_tarjetasActionPerformed

private void jMI_tropasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMI_tropasActionPerformed
    this.jIF_tropas.toFront();

}//GEN-LAST:event_jMI_tropasActionPerformed

private void jMI_acercaDeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMI_acercaDeActionPerformed
    VAcercaDe vac = new VAcercaDe();
    vac.setLocationRelativeTo(null);
    vac.setVisible(true);
}//GEN-LAST:event_jMI_acercaDeActionPerformed

private void jM_ayudaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jM_ayudaActionPerformed
}//GEN-LAST:event_jM_ayudaActionPerformed
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jB_agregar;
    private javax.swing.JButton jB_atacar;
    private javax.swing.JButton jB_canjear;
    private javax.swing.JButton jB_reagrupar;
    private javax.swing.JButton jB_tarjeta;
    private javax.swing.JButton jB_terminarTurno;
    private javax.swing.JButton jB_usar;
    private javax.swing.JCheckBoxMenuItem jCBMI_chat;
    private javax.swing.JCheckBoxMenuItem jCBMI_dados;
    private javax.swing.JCheckBoxMenuItem jCBMI_jugadores;
    private javax.swing.JCheckBoxMenuItem jCBMI_mapa;
    private javax.swing.JCheckBoxMenuItem jCBMI_mision;
    private javax.swing.JCheckBoxMenuItem jCBMI_tarjetas;
    private javax.swing.JCheckBoxMenuItem jCBMI_tropas;
    private javax.swing.JCheckBox jCB_tarjeta0;
    private javax.swing.JCheckBox jCB_tarjeta1;
    private javax.swing.JCheckBox jCB_tarjeta2;
    private javax.swing.JCheckBox jCB_tarjeta3;
    private javax.swing.JCheckBox jCB_tarjeta4;
    private javax.swing.JDesktopPane jDesktopPane1;
    private javax.swing.JEditorPane jEP_comun;
    private javax.swing.JInternalFrame jIF_chat;
    private javax.swing.JInternalFrame jIF_dados;
    private javax.swing.JInternalFrame jIF_jugadores;
    private javax.swing.JInternalFrame jIF_mapa;
    private javax.swing.JInternalFrame jIF_mision;
    private javax.swing.JInternalFrame jIF_tarjetas;
    private javax.swing.JInternalFrame jIF_tropas;
    private javax.swing.JLabel jL_a1;
    private javax.swing.JLabel jL_a2;
    private javax.swing.JLabel jL_a3;
    private javax.swing.JLabel jL_ataque;
    private javax.swing.JLabel jL_d1;
    private javax.swing.JLabel jL_d2;
    private javax.swing.JLabel jL_d3;
    private javax.swing.JLabel jL_defensa;
    private javax.swing.JLabel jL_mapa;
    private javax.swing.JLabel jL_tarjeta0;
    private javax.swing.JLabel jL_tarjeta1;
    private javax.swing.JLabel jL_tarjeta2;
    private javax.swing.JLabel jL_tarjeta3;
    private javax.swing.JLabel jL_tarjeta4;
    private javax.swing.JLabel jL_tarjetaFondo0;
    private javax.swing.JLabel jL_tarjetaFondo1;
    private javax.swing.JLabel jL_tarjetaFondo2;
    private javax.swing.JLabel jL_tarjetaFondo3;
    private javax.swing.JLabel jL_tarjetaFondo4;
    private javax.swing.JLabel jL_tarjetaUs0;
    private javax.swing.JLabel jL_tarjetaUs1;
    private javax.swing.JLabel jL_tarjetaUs2;
    private javax.swing.JLabel jL_tarjetaUs3;
    private javax.swing.JLabel jL_tarjetaUs4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenuItem jMI_acercaDe;
    private javax.swing.JMenuItem jMI_chat;
    private javax.swing.JMenuItem jMI_dados;
    private javax.swing.JMenuItem jMI_jugadores;
    private javax.swing.JMenuItem jMI_mapa;
    private javax.swing.JMenuItem jMI_mision;
    private javax.swing.JMenuItem jMI_ordenar;
    private javax.swing.JMenuItem jMI_salir;
    private javax.swing.JMenuItem jMI_tarjetas;
    private javax.swing.JMenuItem jMI_tropas;
    private javax.swing.JMenu jM_archivo;
    private javax.swing.JMenu jM_ayuda;
    private javax.swing.JMenu jM_traerAlFrente;
    private javax.swing.JMenu jM_ventanas;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jP_dados;
    private javax.swing.JPanel jP_jugadores;
    private javax.swing.JScrollPane jSP_comun;
    private javax.swing.JScrollPane jSP_mision;
    private javax.swing.JPopupMenu.Separator jS_separador;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JToolBar.Separator jSeparator4;
    private javax.swing.JTextArea jTA_mision;
    private javax.swing.JToggleButton jTB_0;
    private javax.swing.JToggleButton jTB_1;
    private javax.swing.JToggleButton jTB_10;
    private javax.swing.JToggleButton jTB_11;
    private javax.swing.JToggleButton jTB_12;
    private javax.swing.JToggleButton jTB_13;
    private javax.swing.JToggleButton jTB_14;
    private javax.swing.JToggleButton jTB_15;
    private javax.swing.JToggleButton jTB_16;
    private javax.swing.JToggleButton jTB_17;
    private javax.swing.JToggleButton jTB_18;
    private javax.swing.JToggleButton jTB_19;
    private javax.swing.JToggleButton jTB_2;
    private javax.swing.JToggleButton jTB_20;
    private javax.swing.JToggleButton jTB_21;
    private javax.swing.JToggleButton jTB_22;
    private javax.swing.JToggleButton jTB_23;
    private javax.swing.JToggleButton jTB_24;
    private javax.swing.JToggleButton jTB_25;
    private javax.swing.JToggleButton jTB_26;
    private javax.swing.JToggleButton jTB_27;
    private javax.swing.JToggleButton jTB_28;
    private javax.swing.JToggleButton jTB_29;
    private javax.swing.JToggleButton jTB_3;
    private javax.swing.JToggleButton jTB_30;
    private javax.swing.JToggleButton jTB_31;
    private javax.swing.JToggleButton jTB_32;
    private javax.swing.JToggleButton jTB_33;
    private javax.swing.JToggleButton jTB_34;
    private javax.swing.JToggleButton jTB_35;
    private javax.swing.JToggleButton jTB_36;
    private javax.swing.JToggleButton jTB_37;
    private javax.swing.JToggleButton jTB_38;
    private javax.swing.JToggleButton jTB_39;
    private javax.swing.JToggleButton jTB_4;
    private javax.swing.JToggleButton jTB_40;
    private javax.swing.JToggleButton jTB_41;
    private javax.swing.JToggleButton jTB_42;
    private javax.swing.JToggleButton jTB_43;
    private javax.swing.JToggleButton jTB_44;
    private javax.swing.JToggleButton jTB_45;
    private javax.swing.JToggleButton jTB_46;
    private javax.swing.JToggleButton jTB_47;
    private javax.swing.JToggleButton jTB_48;
    private javax.swing.JToggleButton jTB_49;
    private javax.swing.JToggleButton jTB_5;
    private javax.swing.JToggleButton jTB_6;
    private javax.swing.JToggleButton jTB_7;
    private javax.swing.JToggleButton jTB_8;
    private javax.swing.JToggleButton jTB_9;
    private javax.swing.JTextField jTF_cantAfrica;
    private javax.swing.JTextField jTF_cantAmNorte;
    private javax.swing.JTextField jTF_cantAmSur;
    private javax.swing.JTextField jTF_cantAsia;
    private javax.swing.JTextField jTF_cantEuropa;
    private javax.swing.JTextField jTF_cantOceania;
    private javax.swing.JTextField jTF_cantTotales;
    private javax.swing.JTextField jTF_mandarMensaje;
    private javax.swing.JTextField jTF_tiempo;
    private javax.swing.JTextField jTF_usuario;
    private javax.swing.JToolBar jToolBar1;
    // End of variables declaration//GEN-END:variables

    public void avisarNuevoMensaje(int id, String mensaje) {
        String aux = this.jEP_comun.getText();
        for (int i = 0; i < jugadores.size(); i++) {
            if (jugadores.get(i).getId() == id) {
                this.jEP_comun.setText(aux.substring(0, aux.indexOf("<body>") + 6) + "<font color=" + jugadores.get(i).getCodigoColor() + ">" + jugadores.get(i).getNomUsuario() + "</font>" + ": " + mensaje + "<br>" + aux.substring(aux.indexOf("<body>") + 6, aux.length()));

                break;
            }
        }
    }

    private void crearYAsignarPaises(int[] paises) {

        JToggleButton[] botones = {
            jTB_0, jTB_1, jTB_2, jTB_3, jTB_4, jTB_5, jTB_6, jTB_7, jTB_8, jTB_9, jTB_10, jTB_11, jTB_12, jTB_13, jTB_14, jTB_15, jTB_16, jTB_17, jTB_18, jTB_19, jTB_20, jTB_21, jTB_22, jTB_23, jTB_24, jTB_25, jTB_26, jTB_27, jTB_28, jTB_29, jTB_30, jTB_31, jTB_32, jTB_33, jTB_34, jTB_35, jTB_36, jTB_37, jTB_38, jTB_39, jTB_40, jTB_41, jTB_42, jTB_43, jTB_44, jTB_45, jTB_46, jTB_47, jTB_48, jTB_49
        };

        //Metodo Con XML
        try {
            DocumentBuilderFactory fabrica1 = DocumentBuilderFactory.newInstance();
            fabrica1.setValidating(true);
            fabrica1.setIgnoringElementContentWhitespace(true);

            DocumentBuilder constructor1 = fabrica1.newDocumentBuilder();
            File datosPais = new File("./datos/datosPaises.xml");
            //File datosPais = new File(getClass().getResource("/datos/datosPaises.xml").toURI().getPath());
            if (datosPais.exists()) {
                System.out.println("El archivo existe, creando paises");
            }
            Document paisesDocumento = constructor1.parse(datosPais);
            Element paisElemento = paisesDocumento.getDocumentElement();
            NodeList NodoPais = paisElemento.getChildNodes();

            Pais p;
            for (int i = 0; i < NodoPais.getLength(); i++) {

                Element pais = (Element) NodoPais.item(i);
                NodeList idLista = pais.getElementsByTagName("id");
                Text id = (Text) idLista.item(0).getFirstChild();

                NodeList listaNombre = pais.getElementsByTagName("nombre");
                Text nombre = (Text) listaNombre.item(0).getFirstChild();

                p = new Pais(Integer.parseInt(id.getData()), nombre.getData(), botones[i]);
                p.actualizarConquistador(jugadores.get(paises[i]));

                NodeList listaIdCont = pais.getElementsByTagName("idcontinente");
                Text idCont = (Text) listaIdCont.item(0).getFirstChild();
                p.setIdContinente(Integer.parseInt(idCont.getData()));

                NodeList listaRuta = pais.getElementsByTagName("rutaImagen");
                Text ruta = (Text) listaRuta.item(0).getFirstChild();
                ImageIcon ic = new ImageIcon(getClass().getResource(ruta.getData()));
                p.addImagen(ic);

                this.paises.put(p);
                jugadores.get(paises[i]).addPais(p);
                if (jugadores.get(paises[i]).getId() == cli.getIdJugador()) {
                    jugadores.get(paises[i]).actualizarContadorPais(p);
                }
            }

            agregarLimitesEImagen();
        } catch (IOException ex) {
            System.out.println("ERROR: el archivo no existe, no se pudieron crear los paises");
        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }

    private void habilitarAgregarTropas() {
        this.jIF_tropas.toFront();
        if (this.ronda == 1) {
            this.cantidadTropasAgregar = 5;
            if (this.tipoMision == 0) {
                if (this.tipoMision == 0) {
                    verificarMisionOcupacion();
                }

            }
            //verificarMisionOcupacion();
        } else if (this.ronda == 2) {
            this.cantidadTropasAgregar = 3;
        } else {
            calcularTropasPorContinentes();
            this.cantidadTropasAgregar = calcularTropasAgregar();
        }

        this.jTF_cantTotales.setText("" + this.cantidadTropasAgregar);
        this.jTF_cantAmSur.setText("" + this.cantidadTropasAgregarPorContinentes[0]);
        this.jTF_cantAmNorte.setText("" + this.cantidadTropasAgregarPorContinentes[1]);
        this.jTF_cantAfrica.setText("" + this.cantidadTropasAgregarPorContinentes[2]);
        this.jTF_cantEuropa.setText("" + this.cantidadTropasAgregarPorContinentes[3]);
        this.jTF_cantAsia.setText("" + this.cantidadTropasAgregarPorContinentes[4]);
        this.jTF_cantOceania.setText("" + this.cantidadTropasAgregarPorContinentes[5]);
        //Habilitación de botones
        this.jB_agregar.setEnabled(true);
        this.jB_terminarTurno.setEnabled(true);

        habilitarPaises();

    }

    private void habilitarPaises() {
        this.deshabilitarTodosPaises();
        for (int i = 0; i < this.paises.size(); i++) {
            Pais aux = (Pais) paises.getObject(i);
            if (aux.getConquistador().getId() == cli.getIdJugador()) {
                aux.getJB().setEnabled(true);
            }
        }
    }

    private void apretarBotonPais(ActionEvent evt) {
        if (rondaAtaque() && cli.getIdJugador() == this.jugadorTurnoActual) {
            if (!esperandoSegundoPais) {
                if (this.jB_aux != null) {
                    this.jB_aux.setSelected(false);
                }
                this.jB_aux = (JToggleButton) evt.getSource();
                deshabilitarTodosPaises();
                this.jB_aux.setEnabled(true);
                this.jB_aux.setSelected(true);
                Pais aux = (Pais) this.paises.getObject(Integer.parseInt(this.jB_aux.getName()));
                aux.habilitarLimites();
                this.esperandoSegundoPais = true;
            } else {
                if (this.jB_aux != (JToggleButton) evt.getSource()) {
                    if (this.jB_aux2 != null) {
                        this.jB_aux2.setSelected(false);
                    }
                    this.jB_aux2 = (JToggleButton) evt.getSource();
                    deshabilitarTodosPaises();
                    this.jB_aux.setEnabled(true);
                    this.jB_aux.setSelected(true);
                    this.jB_aux2.setEnabled(true);
                    this.jB_aux2.setSelected(true);
                }
            }
        } else {
            if (this.jB_aux != null) {
                this.jB_aux.setSelected(false);
            }
            this.jB_aux = (JToggleButton) evt.getSource();
        }
    }

    public void agregarTropaPais(int idPais) {
        if (cli.getIdJugador() != this.jugadorTurnoActual) {
            this.deshabilitarTodosPaises();
        }
        Pais p = (Pais) this.paises.getObject(idPais);
        p.addTropa(new Tropa(true));
        p.getJB().setEnabled(true);
    }

    public void cambiarTurno() {

        if (cambioRonda) {
            this.jugadorTurnoActual = this.jugadorComienzaRonda;
            cambioRonda = false;
        } else {
            jugadorTurnoActual++;
            if (jugadorTurnoActual == this.jugadores.size()) {
                jugadorTurnoActual = 0;
            }
        }

        paisesConquistadosEnTurno = 0;


        for (int i = 0; i < this.jugadores.size(); i++) {
            if (jugadores.get(i).getId() == jugadorTurnoActual) {
                this.jugadores.get(i).getjL().setForeground(Color.BLACK);
            } else {
                this.jugadores.get(i).getjL().setForeground(Color.GRAY);
            }
        }
        if (jugadorTurnoActual == cli.getIdJugador()) {
            if (jugadores.get(jugadorTurnoActual).getCantidadPaises() != 0) {

                tt = new TiempoTurno(this.tiempoTurno, this);
                tt.start();

                this.jB_aux = null;
                this.jB_aux2 = null;
                esperandoSegundoPais = false;
                this.deshabilitarTodosPaises();
                this.jIF_mapa.toFront();
                //Habilitar botones
                this.jCB_tarjeta0.setEnabled(true);
                this.jCB_tarjeta1.setEnabled(true);
                this.jCB_tarjeta2.setEnabled(true);
                this.jCB_tarjeta3.setEnabled(true);
                this.jCB_tarjeta4.setEnabled(true);
                if (rondaAtaque()) {
                    habilitarTropasReagrupar();
                    habilitarPaises();
                    this.jB_atacar.setEnabled(true);
                    this.jB_reagrupar.setEnabled(true);
                    this.jB_terminarTurno.setEnabled(true);
                } else {
                    habilitarAgregarTropas();
                }
            } else {
                jB_terminarTurnoActionPerformed(null);
            }
        }
    }

    public void cambiarRonda() {
        ronda++;
        if (ronda > 3 && ronda % 2 == 0) {
            this.cambioRonda = true;
            this.jugadorComienzaRonda++;
            if (this.jugadorComienzaRonda == this.jugadores.size()) {
                this.jugadorComienzaRonda = 0;
            }
            for (int i = 0; i < this.jugadores.size(); i++) {
                if (jugadorComienzaRonda == i) {
                    this.jugadores.get(i).getjL().setText(jugadores.get(i).getNomUsuario() + " ←");
                } else {
                    this.jugadores.get(i).getjL().setText(jugadores.get(i).getNomUsuario());
                }
            }
        }
        this.cambiarTurno();
    }

    private void deshabilitarTodosPaises() {
        for (int i = 0; i < paises.size(); i++) {
            ((Pais) this.paises.getObject(i)).getJB().setEnabled(false);
            ((Pais) this.paises.getObject(i)).getJB().setSelected(false);
        }

    }

    private boolean rondaAtaque() {
        if (this.ronda % 2 == 1 && this.ronda != 1) {
            return true;
        } else {
            return false;
        }
    }

    private void agregarLimitesEImagen() {

        try {
            DocumentBuilderFactory fabrica1 = DocumentBuilderFactory.newInstance();
            fabrica1.setValidating(true);
            fabrica1.setIgnoringElementContentWhitespace(true);

            DocumentBuilder constructor1 = fabrica1.newDocumentBuilder();
             File datosPais = new File("./datos/datosPaises.xml");
           // File datosPais = new File(getClass().getResource("/datos/datosPaises.xml").toURI().getPath());
            if (datosPais.exists()) {
                System.out.println("El archivo existe, agregarndo límites");
            }
            Document paisesDocumento = constructor1.parse(datosPais);
            Element paisElemento = paisesDocumento.getDocumentElement();
            NodeList NodoPais = paisElemento.getChildNodes();
            for (int i = 0; i < NodoPais.getLength(); i++) {
                Pais aux = (Pais) this.paises.getObject(i);
                Element pais = (Element) NodoPais.item(i);
                NodeList limiteLista = pais.getElementsByTagName("limite");
                for (int j = 0; j < limiteLista.getLength(); j++) {

                    int idA = Integer.parseInt(limiteLista.item(j).getFirstChild().getNodeValue());
                    aux.addLimite((Pais) this.paises.getObject(idA));
                }


            }

        } catch (IOException ex) {
            System.out.println("ERROR: el archivo no existe, no se pudieron agregar límites");
        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }

    private void atacar() {
        Pais pAtaca = (Pais) paises.getObject(Integer.parseInt(this.jB_aux.getName()));
        int cantidadAtaque = pAtaca.getCantidadTropas() - 1;
        if (cantidadAtaque == 0) {
            JOptionPane.showOptionDialog(
                    this,
                    "Debes poseer mas de una tropa para poder atacar",
                    "Atención",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.INFORMATION_MESSAGE,
                    null,
                    null,
                    "aceptar");
            return;
        }
        if (cantidadAtaque > 3) {
            cantidadAtaque = 3;
        }

        Pais pDefiende = (Pais) paises.getObject(Integer.parseInt(this.jB_aux2.getName()));
        int cantidadDefensa = pDefiende.getCantidadTropas();
        if (cantidadDefensa > 3) {
            cantidadDefensa = 3;
        }

        int ataqueTropa;
        int dadoAtaque;
        int ataqueTotal;

        int defensaTropa;
        int dadoDefensa;
        int defensaTotal;

        LinkedList ataque = new LinkedList(), defensa = new LinkedList();
        for (int i = 0; i < cantidadAtaque; i++) {
            ataqueTropa = 0;
            dadoAtaque = (int) (Math.random() * 6 + 1);
            ataqueTotal = dadoAtaque + ataqueTropa;
            ataque.addInOrder(ataqueTotal);
        }
        for (int i = 0; i < cantidadDefensa; i++) {
            defensaTropa = 0;
            dadoDefensa = (int) (Math.random() * 6 + 1);
            defensaTotal = dadoDefensa + defensaTropa;
            defensa.addInOrder(defensaTotal);
        }

        int ganados = 0;
        int perdidos = 0;
        Comparable a = 0;
        Comparable d = 0;

        String avisar = "avisarAtaque" + delimitador + pAtaca.getId() + delimitador + pDefiende.getId();

        for (int i = 1; i < 4; i++) {
            int aRes = ataque.size() - i;
            if (aRes >= 0) {
                a = ataque.get(aRes);
            }
            int dRes = defensa.size() - i;
            if (dRes >= 0) {
                d = defensa.get(dRes);
            }

            if (aRes >= 0 && dRes >= 0) {
                if (a.compareTo(d) > 0) {//a1 >d1
                    ganados++;
                } else {
                    perdidos++;
                }
            }
            if (a.compareTo(0) == 0) {
                a = "";
            }

            if (d.compareTo(0) == 0) {
                d = "";
            }
            avisar += delimitador + a + delimitador + d;
            if (i == 1) {
                this.jL_a1.setText("" + a);
                this.jL_d1.setText("" + d);
            } else if (i == 2) {
                this.jL_a2.setText("" + a);
                this.jL_d2.setText("" + d);
            } else if (i == 3) {
                this.jL_a3.setText("" + a);
                this.jL_d3.setText("" + d);
            }
            a = d = 0;
        }

        avisar += delimitador + ganados + delimitador + perdidos;


        this.jIF_dados.toFront();
        this.jIF_dados.setBounds(0, 240, this.jIF_dados.getWidth(), this.jIF_dados.getHeight());

        pAtaca.quitarTropas(perdidos);
        if (pDefiende.quitarTropas(ganados) == 0) { //Conquista Pais
            int paConquist = 0;
            if (this.tipoMision == 0) {
                verificarMisionSecundaria(pDefiende);
                paConquist = 30;
            } else if (this.tipoMision == 1) {
                paConquist = 30;
            } else if (this.tipoMision == 2) {
                paConquist = 50;
            }



            int tropasQuedaron = cantidadAtaque - perdidos;

            cantidadPasar = 1;
            DConquista dc = new DConquista(this, true, tropasQuedaron, cantidadPasar);
            dc.setLocationRelativeTo(null);
            dc.setVisible(true);


            actualizarPostConquista(pAtaca, pDefiende);

            if (cantidadPasar == 2) {
                pAtaca.quitarTropas(1);
                pDefiende.addTropa(new Tropa(true));
            } else if (cantidadPasar == 3) {
                pAtaca.quitarTropas(2);
                pDefiende.addTropa(new Tropa(true));
                pDefiende.addTropa(new Tropa(true));
            }

            avisar += delimitador + cantidadPasar;

            if (cantidadPaisesPropios() >= paConquist) {
                finDePartida("USTED GANA");
                cli.avisarFinPartida();
            } else if (!this.jB_tarjeta.isEnabled()) {
                if (this.nroCanje < 3) {
                    this.jB_tarjeta.setEnabled(true);
                } else {
                    paisesConquistadosEnTurno++;
                    if (paisesConquistadosEnTurno > 1) {
                        this.jB_tarjeta.setEnabled(true);
                    }
                }
            }

        }
        cli.avisarAtaque(avisar);
    }

    private void reagrupar() {
        Pais pDesde = (Pais) paises.getObject(Integer.parseInt(this.jB_aux.getName()));
        Pais pHasta = (Pais) paises.getObject(Integer.parseInt(this.jB_aux2.getName()));
        if (pDesde.getCantidadTropasDisponiblesReagrupar() > 0) {
            pDesde.quitarTropas(1);
            pHasta.addTropa(new Tropa(false));
            cli.avisarReagrupacion("avisarReagrupacion" + delimitador + pDesde.getId() + delimitador + pHasta.getId());
        } else {
            JOptionPane.showOptionDialog(
                    this,
                    "No se pueden reagrupar mas tropas. El país de origen debe contener al menos una tropa",
                    "Atención",
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.INFORMATION_MESSAGE,
                    null,
                    null,
                    "aceptar");
        }
    }

    private boolean paisesMismoConquistador(String id1, String id2) {
        int idPais1 = Integer.parseInt(id1), idPais2 = Integer.parseInt(id2);
        Pais p1 = (Pais) paises.getObject(idPais1);
        Pais p2 = (Pais) paises.getObject(idPais2);

        if (p1.getConquistador().getId() == p2.getConquistador().getId()) {
            return true;
        }
        return false;
    }

    public void actualizarAtaque(ArrayList<String> contenidoLineaEntrada) {
        deshabilitarTodosPaises();
        this.jIF_dados.toBack();
        Pais pAtaca = (Pais) paises.getObject(Integer.parseInt(contenidoLineaEntrada.get(1)));
        Pais pDefiende = (Pais) paises.getObject(Integer.parseInt(contenidoLineaEntrada.get(2)));

        int cantidadPasar = Integer.parseInt(contenidoLineaEntrada.get(contenidoLineaEntrada.size() - 1));

        pAtaca.getJB().setEnabled(true);
        pDefiende.getJB().setEnabled(true);

        //Actualizar Textos
        String a1 = contenidoLineaEntrada.get(3);
        String d1 = contenidoLineaEntrada.get(4);
        String a2 = contenidoLineaEntrada.get(5);
        String d2 = contenidoLineaEntrada.get(6);
        String a3 = contenidoLineaEntrada.get(7);
        String d3 = contenidoLineaEntrada.get(8);

        this.jL_a1.setText(a1);
        this.jL_d1.setText(d1);
        this.jL_a2.setText(a2);
        this.jL_d2.setText(d2);
        this.jL_a3.setText(a3);
        this.jL_d3.setText(d3);

        this.jIF_dados.toFront();
        this.jIF_dados.setBounds(0, 240, this.jIF_dados.getWidth(), this.jIF_dados.getHeight());

        try {
            Thread.sleep(1300);
        } catch (InterruptedException ex) {
            Logger.getLogger(VPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }

        int ganados = Integer.parseInt(contenidoLineaEntrada.get(9));
        int perdidos = Integer.parseInt(contenidoLineaEntrada.get(10));

        pAtaca.quitarTropas(perdidos);
        if (pDefiende.quitarTropas(ganados) == 0) {
            actualizarPostConquista(pAtaca, pDefiende);

            if (cantidadPasar == 2) {
                pAtaca.quitarTropas(1);
                pDefiende.addTropa(new Tropa(true));
            } else if (cantidadPasar == 3) {
                pAtaca.quitarTropas(2);
                pDefiende.addTropa(new Tropa(true));
                pDefiende.addTropa(new Tropa(true));
            }

        }
    }

    private int calcularTropasAgregar() {
        int contador = cantidadPaisesPropios();
        if (contador < 6) {
            contador = 6;
        }
        return contador / 2;
    }

    public void actualizarReagrupacion(int desde, int hasta) {
        deshabilitarTodosPaises();

        Pais pDesde = (Pais) paises.getObject(desde);
        Pais pHasta = (Pais) paises.getObject(hasta);

        pDesde.getJB().setEnabled(true);
        pHasta.getJB().setEnabled(true);

        try {
            Thread.sleep(500);
        } catch (InterruptedException ex) {
            Logger.getLogger(VPrincipal.class.getName()).log(Level.SEVERE, null, ex);
        }
        pDesde.quitarTropas(1);
        pHasta.addTropa(new Tropa(false));
    }

    private void habilitarTropasReagrupar() {
        for (int i = 0; i < paises.size(); i++) {
            Pais p = (Pais) paises.getObject(i);
            p.habilitarTropas();
        }
    }

    private int cantidadPaisesPropios() {
        return jugadores.get(this.jugadorTurnoActual).getCantidadPaises();

    }

    private void finDePartida(String msj) {
        finPartida = true;
        this.jB_agregar.setEnabled(false);
        this.jB_atacar.setEnabled(false);
        this.jB_reagrupar.setEnabled(false);
        this.jB_tarjeta.setEnabled(false);
        this.jB_terminarTurno.setEnabled(false);
        for (int j = 0; j < this.paises.size(); j++) {
            ((Pais) this.paises.getObject(j)).getJB().setEnabled(true);
        }
        VFinPartida vf = new VFinPartida(msj);
        vf.setLocationRelativeTo(null);
        vf.setVisible(true);

    }

    public void avisarFinPartida(int idJ) {
        String msj = "El jugador " + this.jugadores.get(idJ).getNomUsuario() + " (" + this.jugadores.get(idJ).getColor() + ") " + " ganó";
        this.finDePartida(msj);
    }

    private void actualizarPostConquista(Pais pAtaca, Pais pDefiende) {
        //Se actualiza el pais atacante
        pAtaca.quitarTropas(1);
        //Se actualiza el jugador ganador
        pAtaca.getConquistador().addPais(pDefiende);
        //Actualizar tema continentes
        Jugador jj = this.jugadores.get(pDefiende.getConquistador().getId());
        int idContinente = pDefiende.getIdContinente();
        jj.restarPaisContinente(idContinente);
        //Se actualiza el jugador perdedor
        pDefiende.getConquistador().removePais(pDefiende);
        //Se actualiza el pais defensor
        pDefiende.actualizarConquistador(jugadores.get(jugadorTurnoActual));
    }

    private void verificarMisionSecundaria(Pais pDefiende) {
        if (jugadores.get(jugadorTurnoActual).getMision().isCumplida(pDefiende)) {
            finDePartida("USTED GANA");
            cli.avisarFinPartida();
        }
    }

    private void verificarMisionOcupacion() {
        if (jugadores.get(cli.getIdJugador()).getMision().isCumplida()) {
            finDePartida("USTED GANA");
            cli.avisarFinPartida();
        }
    }

    private void calcularTropasPorContinentes() {
        int[] paisesContinentes = {6, 10, 6, 9, 15, 4};
        int[] paisesJugador = this.jugadores.get(this.jugadorTurnoActual).getContinentes();

        for (int i = 0; i < paisesContinentes.length; i++) {
            this.cantidadTropasAgregarPorContinentes[i] = 0;
            if (paisesContinentes[i] == paisesJugador[i]) {
                switch (i) {
                    case 0:
                        this.cantidadTropasAgregarPorContinentes[i] = 3;
                        break;
                    case 1:
                        this.cantidadTropasAgregarPorContinentes[i] = 5;
                        break;
                    case 2:
                        this.cantidadTropasAgregarPorContinentes[i] = 3;
                        break;
                    case 3:
                        this.cantidadTropasAgregarPorContinentes[i] = 5;
                        break;
                    case 4:
                        this.cantidadTropasAgregarPorContinentes[i] = 7;
                        break;
                    case 5:
                        this.cantidadTropasAgregarPorContinentes[i] = 2;
                        break;

                }
            }
        }

    }

    private void tomarTarjeta() {
        Jugador j = jugadores.get(this.jugadorTurnoActual);
        if (j.getCantidadTarjetas() < 6) {
            if (this.tarjetas.size() == 0) {
                this.mezclarMazo();
                cli.avisarFinDeMazoTarjeta();
            }

            Tarjeta tarjeta = (Tarjeta) this.tarjetas.removeFirst();

            j.addTarjeta(tarjeta);

            ArrayList<Tarjeta> tar = j.getTarjetas();
            int idPais;
            Pais p;
            for (int i = 0; i < tar.size(); i++) {
                idPais = tar.get(i).getId();
                p = (Pais) paises.getObject(idPais);
                switch (i) {
                    case 0:
                        this.jL_tarjeta0.setText(p.getNombre());
                        this.jL_tarjetaFondo0.setIcon(p.getImagen());
                        this.jCB_tarjeta0.setEnabled(true);
                        break;
                    case 1:
                        this.jL_tarjeta1.setText(p.getNombre());
                        this.jL_tarjetaFondo1.setIcon(p.getImagen());
                        this.jCB_tarjeta1.setEnabled(true);
                        break;
                    case 2:
                        this.jL_tarjeta2.setText(p.getNombre());
                        this.jL_tarjetaFondo2.setIcon(p.getImagen());
                        this.jCB_tarjeta2.setEnabled(true);
                        break;
                    case 3:
                        this.jL_tarjeta3.setText(p.getNombre());
                        this.jL_tarjetaFondo3.setIcon(p.getImagen());
                        this.jCB_tarjeta3.setEnabled(true);
                        break;
                    case 4:
                        this.jL_tarjeta4.setText(p.getNombre());
                        this.jL_tarjetaFondo4.setIcon(p.getImagen());
                        this.jCB_tarjeta4.setEnabled(true);
                        break;
                }
            }
            this.jIF_tarjetas.toFront();
            if (!this.jIF_tarjetas.isVisible()) {
                this.jIF_tarjetas.setVisible(true);
                this.jCBMI_tarjetas.setState(true);
            }
            cli.avisarSolicitudTarjeta();
        } else {
        }
    }

    public void sacarTarjeta() {
        this.tarjetas.removeFirst();
    }

    private void verificarTarjetaSeleccionada(int idTarPos) {

        Jugador j = this.jugadores.get(this.jugadorTurnoActual);
        Tarjeta t = j.getTarjetas().get(idTarPos);
        int nroTarj = t.getId();

        if (j.existePais(nroTarj) && !t.isUsada()) {
            if (this.rondaAtaque()) {
                this.jB_usar.setEnabled(true);
            }
            Pais p = (Pais) this.paises.getObject(nroTarj);
            this.deshabilitarTodosPaises();
            p.getJB().setEnabled(true);
        } else {
            this.deshabilitarTodosPaises();
            this.habilitarPaises();
        }
    }

    private void resetearCBTarjetas() {
        this.jCB_tarjeta0.setSelected(false);
        this.jCB_tarjeta1.setSelected(false);
        this.jCB_tarjeta2.setSelected(false);
        this.jCB_tarjeta3.setSelected(false);
        this.jCB_tarjeta4.setSelected(false);
    }

    private void configuracionInicialVentanas() {
        //Chat
        this.jIF_chat.setBounds(0, 410, 470, 100);
        this.jIF_chat.toBack();
        //Dados
        this.jIF_dados.setBounds(0, 230, 126, 140);
        this.jIF_dados.toBack();
        //this.setLayout(null);
        //Jugadores
        this.jIF_jugadores.setBounds(650, 0, 180, 185);
        //Mapa
        this.jIF_mapa.setBounds(0, 0, 640, 400);
        this.jIF_mapa.toFront();
        //Misión
        this.jIF_mision.setBounds(200, 200, 240, 100);
        this.jIF_mision.toBack();
        //Tarjetas
        this.jIF_tarjetas.setBounds(50, 30, 550, 250);
        this.jIF_tarjetas.toBack();
        //Tropas
        this.jIF_tropas.setBounds(650, 190, 180, 280);
        this.jIF_tropas.toBack();
        this.setBounds(this.getX(), this.getX(), 850, 650);
    }

    public void avisarUsoTarjeta(int idPais) {
        Jugador j = this.jugadores.get(this.jugadorTurnoActual);
        Pais p = j.getPais(idPais);
        p.addTropa(new Tropa(true));
        p.addTropa(new Tropa(true));

        this.deshabilitarTodosPaises();
        p.getJB().setEnabled(true);

        JOptionPane.showOptionDialog(
                this,
                "El jugador " + j.getNomUsuario() + " (" + j.getColor() + ") usó la tarjeta del país " + p.getNombre(),
                "Atención",
                JOptionPane.DEFAULT_OPTION,
                JOptionPane.INFORMATION_MESSAGE,
                null,
                null,
                "aceptar");
        this.deshabilitarTodosPaises();
    }

    private void verificarTarjetasSeleccionadasCanje() {
        Jugador j = this.jugadores.get(this.jugadorTurnoActual);
        int[] nrosTarjs = new int[3];
        int cont = 0;
        for (int i = 0; i < this.cb_tarjetas.length; i++) {
            if (this.cb_tarjetas[i].isSelected()) {
                nrosTarjs[cont] = j.getTarjetas().get(i).getId();
                cont++;
            }
        }

        Pais p0 = (Pais) this.paises.getObject(nrosTarjs[0]);
        Pais p1 = (Pais) this.paises.getObject(nrosTarjs[1]);
        Pais p2 = (Pais) this.paises.getObject(nrosTarjs[2]);

        String pTar0 = p0.getImagen().toString();
        String pTar1 = p1.getImagen().toString();
        String pTar2 = p2.getImagen().toString();
        boolean canjear = false;
        if (p0.getId() == 1 || p0.getId() == 43 || p1.getId() == 1 || p1.getId() == 43 || p2.getId() == 1 || p2.getId() == 43) {
            canjear = true;
        } else {
            if (pTar0.compareTo(pTar1) == 0 && pTar1.compareTo(pTar2) == 0) {
                canjear = true;
            } else if (pTar0.compareTo(pTar1) != 0 && pTar0.compareTo(pTar2) != 0 && pTar1.compareTo(pTar2) != 0) {
                canjear = true;
            }
        }

        if (canjear && !rondaAtaque()) {
            this.jB_canjear.setEnabled(true);
        }
    }

    private void actualizarVentanaTarjetas(Jugador j) {

        this.jL_tarjeta0.setText("");
        this.jL_tarjetaFondo0.setIcon(null);
        this.jL_tarjetaUs0.setText("");
        this.jCB_tarjeta0.setEnabled(false);
        this.jCB_tarjeta0.setSelected(false);

        this.jL_tarjeta1.setText("");
        this.jL_tarjetaFondo1.setIcon(null);
        this.jL_tarjetaUs1.setText("");
        this.jCB_tarjeta1.setEnabled(false);
        this.jCB_tarjeta1.setSelected(false);

        this.jL_tarjeta2.setText("");
        this.jL_tarjetaFondo2.setIcon(null);
        this.jL_tarjetaUs2.setText("");
        this.jCB_tarjeta2.setEnabled(false);
        this.jCB_tarjeta2.setSelected(false);

        this.jL_tarjeta3.setText("");
        this.jL_tarjetaFondo3.setIcon(null);
        this.jL_tarjetaUs3.setText("");
        this.jCB_tarjeta3.setEnabled(false);
        this.jCB_tarjeta3.setSelected(false);

        this.jL_tarjeta4.setText("");
        this.jL_tarjetaFondo4.setIcon(null);
        this.jL_tarjetaUs4.setText("");
        this.jCB_tarjeta4.setEnabled(false);
        this.jCB_tarjeta4.setSelected(false);

        ArrayList<Tarjeta> tar = j.getTarjetas();
        int idPais;
        Pais p;
        for (int i = 0; i < tar.size(); i++) {
            idPais = tar.get(i).getId();
            p = (Pais) paises.getObject(idPais);
            switch (i) {
                case 0:
                    this.jL_tarjeta0.setText(p.getNombre());
                    this.jL_tarjetaFondo0.setIcon(p.getImagen());
                    this.jL_tarjetaUs0.setText(tar.get(0).getEstado());
                    this.jCB_tarjeta0.setEnabled(true);
                    break;
                case 1:
                    this.jL_tarjeta1.setText(p.getNombre());
                    this.jL_tarjetaFondo1.setIcon(p.getImagen());
                    this.jL_tarjetaUs1.setText(tar.get(0).getEstado());
                    this.jCB_tarjeta1.setEnabled(true);
                    break;
                case 2:
                    this.jL_tarjeta2.setText(p.getNombre());
                    this.jL_tarjetaFondo2.setIcon(p.getImagen());
                    this.jL_tarjetaUs2.setText(tar.get(0).getEstado());
                    this.jCB_tarjeta2.setEnabled(true);
                    break;
                case 3:
                    this.jL_tarjeta3.setText(p.getNombre());
                    this.jL_tarjetaFondo3.setIcon(p.getImagen());
                    this.jL_tarjetaUs3.setText(tar.get(0).getEstado());
                    this.jCB_tarjeta3.setEnabled(true);
                    break;
                case 4:
                    this.jL_tarjeta4.setText(p.getNombre());
                    this.jL_tarjetaFondo4.setIcon(p.getImagen());
                    this.jL_tarjetaUs4.setText(tar.get(0).getEstado());
                    this.jCB_tarjeta4.setEnabled(true);
                    break;
            }
        }
    }

    public void setCantidadPasar(int c) {
        this.cantidadPasar = c;
    }

    public void avisarCanjeTarjeta(int idP1, int idP2, int idP3) {
        Tarjeta t1 = new Tarjeta(idP1);
        this.tarjetasFueraDelMazo.add(t1);
        Tarjeta t2 = new Tarjeta(idP2);
        this.tarjetasFueraDelMazo.add(t2);
        Tarjeta t3 = new Tarjeta(idP3);
        this.tarjetasFueraDelMazo.add(t3);

        Jugador j = this.jugadores.get(this.jugadorTurnoActual);
        Pais p1 = (Pais) this.paises.getObject(idP1);
        Pais p2 = (Pais) this.paises.getObject(idP2);
        Pais p3 = (Pais) this.paises.getObject(idP3);
        JOptionPane.showOptionDialog(
                this,
                "El jugador " + j.getNomUsuario() + " (" + j.getColor() + ") realizo el canje de las tarjetas: \n \t\t" + p1.getNombre() + "\n \t\t" + p2.getNombre() + "\n \t\t" + p3.getNombre(),
                "Atención",
                JOptionPane.DEFAULT_OPTION,
                JOptionPane.INFORMATION_MESSAGE,
                null,
                null,
                "aceptar");

    }

    public void mezclarMazo() {
        for (int i = 0; i < this.tarjetasFueraDelMazo.size(); i++) {
            if (i % 2 == 0) {
                this.tarjetas.addFirst(this.tarjetasFueraDelMazo.get(i));
            } else {
                this.tarjetas.addLast(this.tarjetasFueraDelMazo.get(i));
            }
        }
    }

    public void setTiempo(String contador) {
        this.jTF_tiempo.setText(contador);
    }

    public void terminarTurnoTiempo() {
        jB_terminarTurnoActionPerformed(null);
    }

    public void abortar() {
        JOptionPane.showOptionDialog(
                this,
                "Un jugador ha abortado la partida. Se cancelará el juego actual",
                "Atención",
                JOptionPane.DEFAULT_OPTION,
                JOptionPane.INFORMATION_MESSAGE,
                null,
                null,
                "aceptar");
        System.exit(1);

    }
}
